|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.atlassian.util.concurrent.PhasedLatch
@ThreadSafe public class PhasedLatch
A PhasedLatch
is a shared latch that resets after it is released and
can be reused. Potentially waiting threads can test the current phase before
performing an action. The action is then guarded by that phase and can await
that phase to be advanced via a call to release
the
current phase.
Constructor Summary | |
---|---|
PhasedLatch()
|
Method Summary | |
---|---|
void |
await()
Await the current phase. |
boolean |
await(long time,
TimeUnit unit)
Await the current phase for the specified period. |
void |
awaitPhase(int phase)
Await the specified phase. |
boolean |
awaitPhase(int phase,
long period,
TimeUnit unit)
Await the specified phase for the specified period. |
int |
getPhase()
|
void |
release()
Release the current phase. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PhasedLatch()
Method Detail |
---|
public void release()
release
in interface ReusableLatch
public void await() throws InterruptedException
await
in interface Awaitable
InterruptedException
- if interruptedpublic boolean await(long time, TimeUnit unit) throws InterruptedException
await
in interface Awaitable
time
- the period of timeunit
- of time to measure the period in
InterruptedException
- if interruptedpublic void awaitPhase(int phase) throws InterruptedException
phase
- the phase to wait for
InterruptedException
- if interruptedpublic boolean awaitPhase(int phase, long period, TimeUnit unit) throws InterruptedException
phase
- the phase to wait forperiod
- the period of time to wait for, as specified by:unit
- of time to measure the period in
InterruptedException
- if interruptedpublic int getPhase()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |