|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.javatools.buffer.ReadWriteLock
The ReadWriteLock
class is a basic implementation of a
read/write or shared/exclusive lock. It takes care of reference
counting to make sure that every readLock()
and
writeLock()
is balanced by the corresponding
readUnlock()
and writeUnlock()
call.
Overlapping of readLock()
and
readUnlock()
pairs with writeLock()
and
writeLock()
pairs with the same thread are allowed. A
thread that has acquired a readLock()
and is
requesting a writeLock()
must still wait until all
other readers have let go of their lock to proceed. Nested
readLock()
and readUnlock()
pairs are
always allowed.
This implementation does not provide a guarantee to prevent writers from being starved.
Although this class is declared public, it is part of the implementation, and not part of the published API.
Field Summary | |
static int |
EXCLUSIVE
Constant which indicates that the lock is held in write mode. |
static int |
FREE
Constant which indicates that the lock is free. |
static int |
NONE
Constant which indicates that the lock is free. |
static int |
READ
Constant which indicates that the lock is held in read mode. |
static int |
SHARED
Constant which indicates that the lock is held in read mode. |
static int |
WRITE
Constant which indicates that the lock is held in write mode. |
Constructor Summary | |
ReadWriteLock()
Constructs a new ReadWriteLock - the lock is created initially in the unowned state. |
Method Summary | |
void |
assertLockHeld()
Routine useful for making sure the current thread holds one of the locks. |
void |
assertLockNotHeld()
Routine useful for making sure the current thread holds one of the locks. |
void |
assertReadLockHeld()
Routine useful for making sure that the current thread does in fact holds the read lock specifically |
void |
assertWriteLockHeld()
Routine useful for making sure that the current thread does in fact hold the write lock. |
void |
readLock()
Blocking attempt to acquire a read or shared lock. |
void |
readUnlock()
Releases a previously acquired read lock. |
void |
writeLock()
Blocking attempt to acquire a write or exclusive lock. |
void |
writeUnlock()
Releases a previously acquired write lock. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int NONE
public static final int FREE
public static final int READ
public static final int SHARED
public static final int WRITE
public static final int EXCLUSIVE
Constructor Detail |
public ReadWriteLock()
Method Detail |
public void readLock()
public void readUnlock()
public void writeLock()
public void writeUnlock()
public void assertLockNotHeld()
public void assertLockHeld()
public void assertReadLockHeld()
public void assertWriteLockHeld()
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.