|
|
Concurrency utilities with Java Tiger (J2SE 5.0)
Java 1.5 now supports thread safe queues, Timers, locks, and many other enhancements to the threading model.
To give an example of controling a critical code section with a semaphore:
final private Semaphore s= new Semaphore(1, true); s.acquireUninterruptibly();
try
{
System.out.println("This code can only be executed by one thread at a time");
} finally
{
s.release();
}
Further reading...
For more information on Java 1.5 Tiger, you may find
Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.
Other websites on Java Tiger can be found at Links-for-Java.
Home
|