|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ReadWriteLock
A read-write lock component aims at synchronizing the execution of several reader and writer components. Multiple reader components can concurrently read, so long as there are no writers. Only one writer component can write at a given time.
Note: This interface is freely inspired by Doug Lea's
ReadWriteLock
interface.
Field Summary | |
---|---|
static String |
ITF_NAME
The default name of the ReadWriteLock interface. |
Method Summary | |
---|---|
void |
acquireRead()
Gets the read lock. |
void |
acquireWrite()
Gets the write lock. |
boolean |
attemptRead(long msecs)
Attempts to get the read lock. |
boolean |
attemptWrite(long msecs)
Attempts to get the write lock. |
void |
releaseRead()
Releases the read lock. |
void |
releaseWrite()
Releases the write lock. |
Field Detail |
---|
static final String ITF_NAME
ReadWriteLock
interface.
Method Detail |
---|
void acquireRead() throws InterruptedException
InterruptedException
- if the thread is interrupted while trying to
acquire the lock.void releaseRead()
boolean attemptRead(long msecs) throws InterruptedException
msecs
- the number of milleseconds to wait. An argument less than or
equal to zero means not to wait at all. However, this may still
require access to a synchronization lock, which can impose
unbounded delay if there is a lot of contention among threads.
InterruptedException
- if the thread is interrupted while waiting for
the lock.void acquireWrite() throws InterruptedException
InterruptedException
- if the thread is interrupted while trying to
acquire the lock.void releaseWrite()
boolean attemptWrite(long msecs) throws InterruptedException
msecs
- the number of milleseconds to wait. An argument less than or
equal to zero means not to wait at all. However, this may still
require access to a synchronization lock, which can impose
unbounded delay if there is a lot of contention among threads.
InterruptedException
- if the thread is interrupted while waiting for
the lock.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |