Examines ThreadLocal and offers tips for exploiting its power.
Though many Java books and articles recommend double-checked locking, unfortunately, it is not guaranteed to work in Java.
Many authors advocate the double-checked locking idiom to access a Singleton object in an intuitively thread-safe way. Unfortunately, for counterintuitive reasons, double-checked locking doesn't work in Java.
Discussion of two more architectural solutions to threading problems: a synchronous dispatcher (or 'reactor') and an asynchronous dispatcher (or 'active object').
Discusses architectural solutions to threading problems. Takes a look at threads from the perspective of an object-oriented designer, and at how to implement threads in an object-oriented environment, focusing on the implementation of asynchronous methods.
Reader/writer locks let multiple threads safely access a shared resource in an efficient way.
How to implement the Observer pattern (used by AWT/Swing for its event model) in a multithreaded environment.
Timers let you perform fixed-interval operations, such as animation refreshes.
A condition variable adds to wait the ability to not wait when the condition you're waiting for has already taken place; and a counting semaphore lets you control a pool of resources without sucking up machine cycles in polling loops.
Explains from the ground up how to get threads work correctly. (Chuck Allison)
Computers /
Programming /
Languages /
Java
|