saker.util Documentation TaskDoc JavaDoc Packages
public interface BooleanLatch
A single-fire boolean latch synchronization interface.

The interface describes a single-use boolean latch, which can be signalled once that in turn causes all waiters to be released.

The interface is mainly based on the BooleanLatch example code described in the documentation of AbstractQueuedSynchronizer.

saker.util 0.8.4
Methods
public void
Waits for the latch to be signalled.
public boolean
await(long timeout, TimeUnit unit)
Waits for the lats to be signalled or until the given timeout elapses.
public void
Waits for the latch to be signalled in non interruptible mode.
public boolean
awaitUninterruptibly(long timeout, TimeUnit unit)
Waits for the lats to be signalled or until the given timeout elapses in non interruptible mode.
public boolean
Gets if the latch has been signalled.
public static BooleanLatch
Creates a new boolean latch.
public void
Signals the latch and releases all waiters.
public abstract void await() throws InterruptedException
Waits for the latch to be signalled.

If the latch is already signalled when this method is entered, it will return immediately, and will not throw InterruptedException even if the current thread is interrupted.

InterruptedExceptionIf the current thread is interrupted during waiting.
public abstract boolean await(long timeout, TimeUnit unit) throws InterruptedException
Waits for the lats to be signalled or until the given timeout elapses.

If the latch is already signalled when this method is entered, it will return immediately, and will not throw InterruptedException even if the current thread is interrupted.

timeoutThe timeout amount.
unitThe unit if the amount.
true if the latch has been signalled, false if the timeout elapsed.
InterruptedExceptionIf the current thread is interrupted during waiting.
public abstract void awaitUninterruptibly()
Waits for the latch to be signalled in non interruptible mode.
public abstract boolean awaitUninterruptibly(long timeout, TimeUnit unit)
Waits for the lats to be signalled or until the given timeout elapses in non interruptible mode.
timeoutThe timeout amount.
unitThe unit if the amount.
true if the latch has been signalled, false if the timeout elapsed.
public abstract boolean isSignalled()
Gets if the latch has been signalled.
true if the latch is signalled.
Creates a new boolean latch.
The new latch.
public abstract void signal()
Signals the latch and releases all waiters.