Java Concurrency - modern examples, tutorials, excersies, step-by-step apps [closed]
I want to learn features of java.util.concurrent
libraries (so everything older, or non-java specific is no option for me).
I know basics and theory about concurrency and multithreading, I am not looking for theory.
I am now reading Java Concurrency in Practice. To be honest, I am quite disapointed of examples in this book. They're too short and simple and "d开发者_如何学Pythonummy" for me. I am looking for some nice Java 5+ concurrency examples and exercies explained.
Is there something like that? I am quite afraid that If I don't use what I learned in JCIP very soon, I am going to forget it pretty much :/
Why not just search on GitHub (here is an example) ?
I have no affiliation, btw. But you can find projects that use "java concurrency" in the description or refer to the library in the code.
Another option is to think of your favourite Java frameworks. e.g. Tomcat or Quartz (though I don't know if they use Java 5 concurrency per se). Such frameworks would be excellent examples because it is real-world stuff.
definitely learn by making an application. for example, you could make your own real time online stock trading system or even an auction system. stuff like that that will thoroughly test your concepts. or you could participate in open source projects which focus on these types of applications..
I don't agree with your opinion of Java Concurrency in Practice, nevertheless, you might also want to look at "The Art of Multiprocessor Programming" by M. Herlihy and N. Shavait.
I recommend both books to understand more about the underlying principles of concurrency; rather than just skim read some code snippets.
Considering we are talking about "Shared state concurrency"
Look at the implementation of these two frameworks:
LMAX Disruptor :
They have very nicely used the concept of cache lines and ring buffers to achieve an extreme level of concurrency. Of course they are relying on atomic classes in concurrent utils plus their own ring buffer based concepts.
Google Guava Concurrent package:
They have decorated the Futures and Executor interfaces to offer real world concurrent event driven primitives. Underlying their framework is a good understanding of java concurrency classes and design patterns.
Shared state concurrency is not the only flavor, you may also like to check what Actor based frameworks e.g. AKKA are doing. This kind of concurrent programming is called message passing concurrency.
精彩评论