|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.livescribe.ext.util.Latch
public class Latch
A latch that can be used for thread signalling.
Note: This uses the current instance for the wait/notify object.
| Constructor Summary | |
|---|---|
Latch()
Creates a new latch. |
|
| Method Summary | |
|---|---|
boolean |
isSet()
Checks if the latch is set. |
void |
resetLatch()
Resets the latch. |
boolean |
setIfNotSet()
Atomically sets the latch if it is not already set. |
void |
setLatch()
Sets the latch. |
void |
waitLatch()
Waits for the latch to be set. |
boolean |
waitLatch(long timeout)
Waits for the latch to be set. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Latch()
| Method Detail |
|---|
public void setLatch()
resetLatch() is called.
resetLatch()
public void waitLatch()
throws InterruptedException
InterruptedException - if the thread was interrupted while
waiting for the latch to be set.setLatch()
public boolean waitLatch(long timeout)
throws InterruptedException
This waits for the specified period of time. If the time elapses
without the latch being set, then this returns false.
Otherwise, if the latch is set before the time elapses, then this
returns true.
As in the behaviour for Object.wait(long), a timeout of zero
indicates that we should wait forever until notified or interrupted.
timeout - the maximum time to wait, in ms
InterruptedException - if the thread was interrupted while
waiting for the latch to be set.
IllegalArgumentException - if the timeout value is negative.setLatch()public boolean isSet()
public boolean setIfNotSet()
true if the latch state changed, and false
otherwise.
public void resetLatch()
false. No threads
are notified.
setLatch()
|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||