Class AwaitableNoOpRunnable
- java.lang.Object
-
- com.pervasivecode.utils.concurrent.testing.AwaitableNoOpRunnable
-
- All Implemented Interfaces:
AwaitableRunnable,Runnable
public final class AwaitableNoOpRunnable extends Object implements AwaitableRunnable
This is a simple AwaitableRunnable whose only purpose is to signal that it has finished running.
-
-
Constructor Summary
Constructors Constructor Description AwaitableNoOpRunnable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawaitTaskCompletion()Block until the task has finished running.booleanawaitTaskCompletion(long amount, TimeUnit unit)Block until the task has finished running, or until a timeout has expired.booleanequals(Object other)inthashCode()booleanhasTaskFinished()Has the task finished?voidrun()
-
-
-
Method Detail
-
hasTaskFinished
public boolean hasTaskFinished()
Description copied from interface:AwaitableRunnableHas the task finished?- Specified by:
hasTaskFinishedin interfaceAwaitableRunnable- Returns:
- True if the task has finished.
-
awaitTaskCompletion
public void awaitTaskCompletion() throws InterruptedExceptionDescription copied from interface:AwaitableRunnableBlock until the task has finished running.- Specified by:
awaitTaskCompletionin interfaceAwaitableRunnable- Throws:
InterruptedException- If the thread was interrupted while waiting.
-
awaitTaskCompletion
public boolean awaitTaskCompletion(long amount, TimeUnit unit) throws InterruptedExceptionDescription copied from interface:AwaitableRunnableBlock until the task has finished running, or until a timeout has expired.- Specified by:
awaitTaskCompletionin interfaceAwaitableRunnable- Parameters:
amount- The duration of the timeout.unit- The units of the amount parameter.- Returns:
- True if the task completed before the timeout expired; false if it did not.
- Throws:
InterruptedException- If the thread was interrupted while waiting.
-
-