Top Fields Constructors Methods
stormpot

pack-priv final Class LatchCompletion

extends Object
implements Completion
Class Inheritance
All Implemented Interfaces
stormpot.Completion
Imports
java.util.Objects, java.util.concurrent.CountDownLatch

Field Summary

Modifier and TypeField and Description
private final CountDownLatch

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
await(Timeout
The timeout delimiting the maximum time to wait for the task to complete. Timeouts with zero or negative values will cause the method to return immediately.
timeout
)

Implements stormpot.Completion.await.

Causes the current thread to wait until the completion is finished, or the thread is interrupted, or the specified waiting time elapses.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

completionLatchback to summary
private final CountDownLatch completionLatch

Constructor Detail

LatchCompletionback to summary
pack-priv LatchCompletion(CountDownLatch completionLatch)

Method Detail

awaitback to summary
public boolean await(Timeout timeout) throws InterruptedException

Implements stormpot.Completion.await.

Doc from stormpot.Completion.await.

Causes the current thread to wait until the completion is finished, or the thread is interrupted, or the specified waiting time elapses. If the task represented by this completion has already completed, the method immediately returns `true`. If the current thread already has its interrupted status set upon entry to this method, or the thread is interrupted while waiting, then an InterruptedException is thrown and the current threads interrupted status is cleared. If the specified waiting time elapses, then the method returns `false`.

Parameters
timeout:Timeout

The timeout delimiting the maximum time to wait for the task to complete. Timeouts with zero or negative values will cause the method to return immediately.

Returns:boolean

`true` if the task represented by this completion completed within the specified waiting time, or was already complete upon entry to this method; or `false` if the specified Timeout elapsed before the task could finished.

Exceptions
InterruptedException:
if the current thread is interrupted while waiting.