Package java.util.concurrent.locks


Package java.util.concurrent.locks

Java 5.0

This package defines Lock and associated Condition interfaces as well as concrete implementations (such as ReentrantLock ) that provide an alternative to locking with synchronized blocks and methods and to waiting with the wait( ) , notify( ) , and notifyAll( ) methods of Object .

Although Lock and Condition are somewhat more complex to use than the built-in locking, waiting, and notification mechanisms of Object , they are also more flexible. Lock , for example, does not require that locks be block-structured and enables algorithms such as "hand-over-hand locking" for traversing linked data structures. A thread waiting to acquire a Lock can time out or be interrupted , which is not possible with synchronized locking. Also, more than one Condition can be associated with a given Lock , which is simply not possible with Object -based locking and waiting.

The ReadWriteLock interface and its ReentrantReadWriteLock implementation allow multiple concurrent readers but only a single writer thread to hold the lock.

Interfaces

 public interface  Condition  ; public interface  Lock  ; public interface  ReadWriteLock  ; 

Classes

 public abstract class  AbstractQueuedSynchronizer  implements Serializable; public class  AbstractQueuedSynchronizer.ConditionObject  implements Condition, Serializable; public class  LockSupport  ; public class  ReentrantLock  implements Lock, Serializable; public class  ReentrantReadWriteLock  implements ReadWriteLock, Serializable; public static class  ReentrantReadWriteLock.ReadLock  implements Lock, Serializable; public static class  ReentrantReadWriteLock.WriteLock  implements Lock, Serializable; 



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net