|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.java.lang.Lock
This is a reader/writer lock object. The code is vaugely based on an example from _Concurrent Programming in Java_, by Doug Lea.
As implemented, JServLock works as an actual "lock" object, which another object will set up and lock and unlock. It blocks incoming readers if there are waiting writers.
There are method that wait only at specified amount of time before failing with TimeoutException.
Constructor Summary | |
Lock()
|
Method Summary | |
void |
readLock()
Wait for a read lock. |
void |
readLock(long timeout)
Wait for a read lock. |
void |
readUnlock()
Unlocks a previously acquired read lock. |
void |
writeLock()
Wait for a read lock. |
void |
writeLock(long timeout)
Wait for a read lock. |
void |
writeUnlock()
Unlock a previously acquired write lock. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Lock()
Method Detail |
public void readLock() throws java.lang.InterruptedException
public void readLock(long timeout) throws java.lang.InterruptedException, TimeoutException
timeout
- the number of millisecond before giving up and failing
with a TimeoutException.public void readUnlock()
public void writeLock() throws java.lang.InterruptedException
public void writeLock(long timeout) throws java.lang.InterruptedException, TimeoutException
timeout
- the number of millisecond before giving up and failing
with a TimeoutException.public void writeUnlock()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |