Interface ICompletionSync
-
- All Known Implementing Classes:
AQueryRunner.SyncCompletionSync,CompletionSync,ForkJoinPoolNonStealableCompletionSync,QueryPartitionTaskCompleter
public interface ICompletionSyncA synchronization Object associated with a task that can be used to wait for the task to complete.This is often returned as a result of a
voidmethod that is performing asynchronous work, so that the caller can wait for the work to be done and be informed of anyexceptionthat might have aroused.- Author:
- ActiveViam
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidawaitCompletion()Waits if necessary for the associated task to complete.voidawaitCompletion(long timeout, TimeUnit unit)Waits if necessary for at most the given time for the associated task to complete.default voidawaitCompletion(Duration duration)Waits if necessary for at most the given time for the associated task to complete.booleanisDone()Returns true if the task completed.
-
-
-
Method Detail
-
isDone
boolean isDone()
Returns true if the task completed.Completion may be due to normal termination, an exception, or cancellation -- in all of these cases, this method will return true.
- Returns:
- true if the task completed
-
awaitCompletion
void awaitCompletion()
Waits if necessary for the associated task to complete.This method will re-throw any
exceptionencountered during the execution of the task, possibly wrapped in aRuntimeException.
-
awaitCompletion
void awaitCompletion(long timeout, TimeUnit unit) throws TimeoutExceptionWaits if necessary for at most the given time for the associated task to complete.This method will re-throw any
exceptionencountered during the execution of the task, possibly wrapped in aRuntimeException.Reaching the timeout will cause the query tasks to be cancelled.
- Parameters:
timeout- The maximum time to waitunit- The time unit of the timeout argument- Throws:
TimeoutException- if the wait timed out
-
awaitCompletion
default void awaitCompletion(Duration duration) throws TimeoutException
Waits if necessary for at most the given time for the associated task to complete.This method will re-throw any
exceptionencountered during the execution of the task, possibly wrapped in aRuntimeException.Reaching the timeout will cause the query tasks to be cancelled.
- Parameters:
duration- The maximum time to wait- Throws:
TimeoutException- if the wait timed out
-
-