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 void
awaitTaskCompletion()
Block until the task has finished running.boolean
awaitTaskCompletion(long amount, TimeUnit unit)
Block until the task has finished running, or until a timeout has expired.boolean
equals(Object other)
int
hashCode()
boolean
hasTaskFinished()
Has the task finished?void
run()
-
-
-
Method Detail
-
hasTaskFinished
public boolean hasTaskFinished()
Description copied from interface:AwaitableRunnable
Has the task finished?- Specified by:
hasTaskFinished
in interfaceAwaitableRunnable
- Returns:
- True if the task has finished.
-
awaitTaskCompletion
public void awaitTaskCompletion() throws InterruptedException
Description copied from interface:AwaitableRunnable
Block until the task has finished running.- Specified by:
awaitTaskCompletion
in interfaceAwaitableRunnable
- Throws:
InterruptedException
- If the thread was interrupted while waiting.
-
awaitTaskCompletion
public boolean awaitTaskCompletion(long amount, TimeUnit unit) throws InterruptedException
Description copied from interface:AwaitableRunnable
Block until the task has finished running, or until a timeout has expired.- Specified by:
awaitTaskCompletion
in 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.
-
-