views:

48

answers:

2

Does anybody have suggestions for good resources and exercises on Java concurrency, particularly the new Java 5 constructs?

They should have model answers ideally. I also found the following a number of good examples in State Models and Concurrency (Magee):

http://www.doc.ic.ac.uk/~jnm/book/

A: 

One of the best book on subject is Java Concurrency in Practice.

Part I: Fundamentals

Thread Safety

Sharing Objects

Composing Objects

Building Blocks

Part II: Structuring Concurrent Applications

Task Execution (downloadable sample chapter)

Cancellation and Shutdown

Applying Thread Pools

GUI Applications

Part III: Liveness, Performance, and Testing

Avoiding Liveness Hazards

Performance and Scalability

Testing Concurrent Programs

Part IV: Advanced Topics

Explicit Locks

Building Custom Synchronizers

Atomic Variables and Nonblocking Synchronization

The Java Memory Model

I think its more than enough to get started with concurrency in Java.

Sorantis
I have JCIP, it's a great book, but very theoretical, looking for something more hands on than this...
Jon
+1  A: 

JCiP has already been mentioned, but it doesn't have exercises. If you want something that will tear your head in two, see Herlihy's Art of Multiprocessor Programming, which uses Java, and dives deep into concurrency theory. It has exercises and companion code.

Not to mention that Prof. Herlihy is a stand-up guy, and brilliant besides.

JCiP is the right thing if you want practical guidance on use of the new concurrency utilities (you should also scan the archives of concurrency-interest). But if you want to go deeper, AoMP.

andersoj
I have JCIP, great book, but wanted more hands on stuff, looks good. Thanks...
Jon
@Jon: Well, AoMP is hands-on in the sense of getting down and dirty with implementation, but it's definitely at a lower level of abstraction. You'll learn the six different ways of implementing a concurrent Set, but you won't learn how to attach post-execution hooks to tasks in an `Executor`.
andersoj