Class ReentrantCircuit
java.lang.Object
net.jodah.concurrentunit.internal.ReentrantCircuit
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Synchronization state of 0 = closed, 1 = open. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
await()
Waits for the circuit to be closed, aborting if interrupted.boolean
Waits for thewaitDuration
until the circuit has been closed, aborting if interrupted, returning true if the circuit is closed else false.void
close()
Closes the circuit, releasing any waiting threads.void
Interrupts waiting threads.boolean
isClosed()
Returns whether the circuit is closed.void
open()
Opens the circuit.toString()
-
Field Details
-
sync
-
-
Constructor Details
-
ReentrantCircuit
public ReentrantCircuit()
-
-
Method Details
-
await
Waits for the circuit to be closed, aborting if interrupted.- Throws:
InterruptedException
-
await
Waits for thewaitDuration
until the circuit has been closed, aborting if interrupted, returning true if the circuit is closed else false.- Throws:
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
-