Package org.redisson.misc
Class ReclosableLatch
- java.lang.Object
-
- java.util.concurrent.locks.AbstractOwnableSynchronizer
-
- java.util.concurrent.locks.AbstractQueuedSynchronizer
-
- org.redisson.misc.ReclosableLatch
-
- All Implemented Interfaces:
Serializable
public class ReclosableLatch extends AbstractQueuedSynchronizer
A thread gate, that uses anAbstractQueuedSynchronizer.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:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer
AbstractQueuedSynchronizer.ConditionObject
-
-
Constructor Summary
Constructors Constructor Description ReclosableLatch()ReclosableLatch(boolean defaultOpen)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawait()booleanawait(long time, TimeUnit unit)voidawaitUninterruptibly()voidclose()booleanisOpened()voidopen()StringtoString()inttryAcquireShared(int ignored)booleantryReleaseShared(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
-
-
-
-
Method Detail
-
tryAcquireShared
public final int tryAcquireShared(int ignored)
- Overrides:
tryAcquireSharedin classAbstractQueuedSynchronizer
-
tryReleaseShared
public final boolean tryReleaseShared(int state)
- Overrides:
tryReleaseSharedin classAbstractQueuedSynchronizer
-
open
public final void open()
-
close
public final void close()
-
isOpened
public boolean isOpened()
-
await
public final void await() throws InterruptedException- Throws:
InterruptedException
-
awaitUninterruptibly
public final void awaitUninterruptibly()
-
await
public final boolean await(long time, TimeUnit unit) throws InterruptedException- Throws:
InterruptedException
-
toString
public String toString()
- Overrides:
toStringin classAbstractQueuedSynchronizer
-
-