Class ResettableOneOffLatch
- java.lang.Object
-
- org.sheinbergon.needle.concurrent.util.ResettableOneOffLatch
-
public final class ResettableOneOffLatch extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ResettableOneOffLatch()Initializes this latch in an 'unlatched' mode.ResettableOneOffLatch(boolean latched)Initializes this latch in either 'latched' or 'unlatched' mode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawait(boolean reset)Wait for this latch to fire, optionally resetting it fires.voidfire()Unlatches this latch, moving it to an unlatched mode.voidreset()Reset this latch back to a 'latched' state, irregardless of its current state.
-
-
-
Constructor Detail
-
ResettableOneOffLatch
public ResettableOneOffLatch()
Initializes this latch in an 'unlatched' mode.
-
ResettableOneOffLatch
public ResettableOneOffLatch(boolean latched)
Initializes this latch in either 'latched' or 'unlatched' mode.- Parameters:
latched- Setting this totrueinstantiates this class in a 'latched' mode, requiring an initial call tofire()in order to unlatch
-
-
Method Detail
-
reset
public void reset()
Reset this latch back to a 'latched' state, irregardless of its current state.
-
fire
public void fire()
Unlatches this latch, moving it to an unlatched mode.
-
await
public void await(boolean reset)
Wait for this latch to fire, optionally resetting it fires.- Parameters:
reset- whether or not to reset this latch after it fires
-
-