|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.util.UtlReadWriteLock
public class UtlReadWriteLock
Class implementing a read write lock.
This class provides the functionality of read-write locks. A read-write lock allows multiple threads to acquire a read lock provided no other thread currently has a write lock on the same object. A thread can acquire a write lock if no other thread owns either a read lock or a write lock
This class IS NOT intended to be used by end users.
Method Summary | |
---|---|
static UtlReadWriteLock |
create(String name)
Create a read-write lock. |
void |
getReadLock()
Acquire a read lock. |
void |
getReadLockUninterrupted()
Convenience method that acquires a read lock but ignores the interrupted exception. |
void |
getWriteLock()
Acquire a write lock. |
void |
getWriteLockUninterrupted()
Convenience method that acquires a write lock but ignores the interrupted exception. |
void |
releaseLock()
Release an acquired read or write lock |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static UtlReadWriteLock create(String name)
name
- A name used to identify the lock for trace/debugging purposes
public final void getReadLock() throws InterruptedException
InterruptedException
- If another thread has interrupted the
current thread while it was waiting for the lock to be released
by other threads. The interrupted status of the current thread is
cleared when this exception is thrownpublic final void getReadLockUninterrupted()
This method attempts to acquire a read lock but does not return in case the wait is interrupted. It case the wait is interrupted, the method traps the interrupted exception, puts out a warning and continues to wait for the read lock.
public final void getWriteLock() throws InterruptedException
InterruptedException
- If another thread has interrupted the
current thread while it was waiting for the lock to be released
by other threads. The interrupted status of the current thread is
cleared when this exception is thrownpublic final void getWriteLockUninterrupted()
This method attempts to acquire a write lock but does not return in case the wait is interrupted. It case the wait is interrupted, the method traps the interrupted exception, puts out a warning and continues to wait for the write lock.
public final void releaseLock()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |