Class ReentrantCircuit
- java.lang.Object
-
- net.jodah.concurrentunit.internal.ReentrantCircuit
-
public class ReentrantCircuit extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classReentrantCircuit.SyncSynchronization state of 0 = closed, 1 = open.
-
Field Summary
Fields Modifier and Type Field Description private ReentrantCircuit.Syncsync
-
Constructor Summary
Constructors Constructor Description ReentrantCircuit()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawait()Waits for the circuit to be closed, aborting if interrupted.booleanawait(long waitDuration, java.util.concurrent.TimeUnit timeUnit)Waits for thewaitDurationuntil the circuit has been closed, aborting if interrupted, returning true if the circuit is closed else false.voidclose()Closes the circuit, releasing any waiting threads.voidinterruptWaiters()Interrupts waiting threads.booleanisClosed()Returns whether the circuit is closed.voidopen()Opens the circuit.java.lang.StringtoString()
-
-
-
Field Detail
-
sync
private final ReentrantCircuit.Sync sync
-
-
Method Detail
-
await
public void await() throws java.lang.InterruptedExceptionWaits for the circuit to be closed, aborting if interrupted.- Throws:
java.lang.InterruptedException
-
await
public boolean await(long waitDuration, java.util.concurrent.TimeUnit timeUnit) throws java.lang.InterruptedExceptionWaits for thewaitDurationuntil the circuit has been closed, aborting if interrupted, returning true if the circuit is closed else false.- Throws:
java.lang.InterruptedException
-
close
public void close()
Closes the circuit, releasing any waiting threads.
-
interruptWaiters
public void interruptWaiters()
Interrupts waiting threads.
-
isClosed
public boolean isClosed()
Returns whether the circuit is closed.
-
open
public void open()
Opens the circuit.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-