Class ReentrantCircuit.Sync
- java.lang.Object
-
- java.util.concurrent.locks.AbstractOwnableSynchronizer
-
- java.util.concurrent.locks.AbstractQueuedSynchronizer
-
- net.jodah.concurrentunit.internal.ReentrantCircuit.Sync
-
- All Implemented Interfaces:
Serializable
- Enclosing class:
- ReentrantCircuit
static final class ReentrantCircuit.Sync extends AbstractQueuedSynchronizer
Synchronization state of 0 = closed, 1 = open.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer
AbstractQueuedSynchronizer.ConditionObject
-
-
Constructor Summary
Constructors Constructor Description Sync()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) booleanisClosed()(package private) voidopen()set state to 1.protected inttryAcquireShared(int acquires)Opens the circuit if not a test.booleantryReleaseShared(int ignored)Closes the circuit.-
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, toString, tryAcquire, tryAcquireNanos, tryAcquireSharedNanos, tryRelease
-
Methods inherited from class java.util.concurrent.locks.AbstractOwnableSynchronizer
getExclusiveOwnerThread, setExclusiveOwnerThread
-
-
-
-
Method Detail
-
tryReleaseShared
public boolean tryReleaseShared(int ignored)
Closes the circuit.- Overrides:
tryReleaseSharedin classAbstractQueuedSynchronizer- Parameters:
ignored- int; release does not use the int param.
-
tryAcquireShared
protected int tryAcquireShared(int acquires)
Opens the circuit if not a test.- Overrides:
tryAcquireSharedin classAbstractQueuedSynchronizer- Parameters:
acquires- when 0, return whether circuit is closed. When 1, open call
-
isClosed
boolean isClosed()
- Returns:
- whether state == 0
-
open
void open()
set state to 1.
-
-