Package org.infinispan.util.concurrent
Class ReclosableLatch
java.lang.Object
java.util.concurrent.locks.AbstractOwnableSynchronizer
java.util.concurrent.locks.AbstractQueuedSynchronizer
org.infinispan.util.concurrent.ReclosableLatch
- All Implemented Interfaces:
Serializable
A thread gate, that uses an
AbstractQueuedSynchronizer
.
This implementation allows you to create a latch with a default state (open or closed), and repeatedly open or close
the latch.- Since:
- 4.0
- Author:
- Manik Surtani (manik@jboss.org)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer
AbstractQueuedSynchronizer.ConditionObject
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
await()
final boolean
final void
close()
boolean
isOpened()
final void
open()
toString()
final int
tryAcquireShared
(int ignored) final boolean
tryReleaseShared
(int state) Methods inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer
acquire, acquireInterruptibly, acquireShared, acquireSharedInterruptibly, compareAndSetState, getExclusiveQueuedThreads, getFirstQueuedThread, getQueuedThreads, getQueueLength, getSharedQueuedThreads, getState, getWaitingThreads, getWaitQueueLength, hasContended, hasQueuedPredecessors, hasQueuedThreads, hasWaiters, isHeldExclusively, isQueued, owns, release, releaseShared, setState, tryAcquire, tryAcquireNanos, tryAcquireSharedNanos, tryRelease
Methods inherited from class java.util.concurrent.locks.AbstractOwnableSynchronizer
getExclusiveOwnerThread, setExclusiveOwnerThread
-
Constructor Details
-
ReclosableLatch
public ReclosableLatch() -
ReclosableLatch
public ReclosableLatch(boolean defaultOpen)
-
-
Method Details
-
open
public final void open() -
close
public final void close() -
isOpened
public boolean isOpened() -
await
- Throws:
InterruptedException
-
await
- Throws:
InterruptedException
-
toString
- Overrides:
toString
in classAbstractQueuedSynchronizer