Parent Directory
|
Revision Log
Revision 1.13 - (view) (download) (as text)
| 1 : | dl | 1.1 | <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 : | <html> <head> | ||
| 3 : | <title>Locks</title> | ||
| 4 : | jsr166 | 1.13 | <!-- |
| 5 : | Written by Doug Lea with assistance from members of JCP JSR-166 | ||
| 6 : | Expert Group and released to the public domain, as explained at | ||
| 7 : | http://creativecommons.org/licenses/publicdomain | ||
| 8 : | --> | ||
| 9 : | dl | 1.1 | </head> |
| 10 : | |||
| 11 : | <body> | ||
| 12 : | |||
| 13 : | dl | 1.3 | Interfaces and classes providing a framework for locking and waiting |
| 14 : | for conditions that is distinct from built-in synchronization and | ||
| 15 : | dl | 1.2 | monitors. The framework permits much greater flexibility in the use of |
| 16 : | locks and conditions, at the expense of more awkward syntax. | ||
| 17 : | dl | 1.1 | |
| 18 : | dl | 1.7 | <p> The {@link java.util.concurrent.locks.Lock} interface supports |
| 19 : | locking disciplines that differ in semantics (reentrant, fair, etc), | ||
| 20 : | and that can be used in non-block-structured contexts including | ||
| 21 : | hand-over-hand and lock reordering algorithms. The main implementation | ||
| 22 : | jsr166 | 1.11 | is {@link java.util.concurrent.locks.ReentrantLock}. |
| 23 : | dl | 1.1 | |
| 24 : | <p> The {@link java.util.concurrent.locks.ReadWriteLock} interface | ||
| 25 : | similarly defines locks that may be shared among readers but are | ||
| 26 : | exclusive to writers. Only a single implementation, {@link | ||
| 27 : | java.util.concurrent.locks.ReentrantReadWriteLock}, is provided, since | ||
| 28 : | dl | 1.2 | it covers most standard usage contexts. But programmers may create |
| 29 : | dl | 1.1 | their own implementations to cover nonstandard requirements. |
| 30 : | |||
| 31 : | <p> The {@link java.util.concurrent.locks.Condition} interface | ||
| 32 : | dl | 1.5 | describes condition variables that may be associated with Locks. |
| 33 : | These are similar in usage to the implicit monitors accessed using | ||
| 34 : | <tt>Object.wait</tt>, but offer extended capabilities. In particular, | ||
| 35 : | multiple <tt>Condition</tt> objects may be associated with a single | ||
| 36 : | <tt>Lock</tt>. To avoid compatibility issues, the names of | ||
| 37 : | <tt>Condition</tt> methods are different than the corresponding | ||
| 38 : | <tt>Object</tt> versions. | ||
| 39 : | dl | 1.2 | |
| 40 : | dl | 1.7 | <p> The {@link java.util.concurrent.locks.AbstractQueuedSynchronizer} |
| 41 : | class serves as a useful superclass for defining locks and other | ||
| 42 : | synchronizers that rely on queuing blocked threads. The {@link | ||
| 43 : | dl | 1.10 | java.util.concurrent.locks.AbstractQueuedLongSynchronizer} class |
| 44 : | provides the same functionality but extends support to 64 bits of | ||
| 45 : | dl | 1.12 | synchronization state. Both extend class {@link |
| 46 : | java.util.concurrent.locks.AbstractOwnableSynchronizer}, a simple | ||
| 47 : | class that helps record the thread currently holding exclusive | ||
| 48 : | synchronization. The {@link java.util.concurrent.locks.LockSupport} | ||
| 49 : | class provides lower-level blocking and unblocking support that is | ||
| 50 : | useful for those developers implementing their own customized lock | ||
| 51 : | classes. | ||
| 52 : | dl | 1.1 | |
| 53 : | dl | 1.9 | @since 1.5 |
| 54 : | |||
| 55 : | dl | 1.1 | </body> </html> |
| Doug Lea | ViewVC Help |
| Powered by ViewVC 1.0.8 |