Interface PausingRunnable
-
- All Superinterfaces:
Runnable
- All Known Implementing Classes:
PausingAwaitableNoOpRunnable,PausingNoOpRunnable
public interface PausingRunnable extends Runnable
A Runnable that pauses (waiting for a call tounpause()) at the start of itsRunnable.run()method.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanhasPaused()Has the PausingRunnable paused yet? If it has been unpaused this will also return true.booleanhasUnpaused()Has the PausingRunnable been paused and then unpaused?voidunpause()Release a paused PausingRunnable so that it can continue running.voidwaitUntilPaused()Block the current thread indefinitely, until the PausingRunnable is paused.booleanwaitUntilPaused(long amount, TimeUnit unit)Block the current thread until the PausingRunnable is paused, unless a timeout has expired while waiting.
-
-
-
Method Detail
-
hasPaused
boolean hasPaused()
Has the PausingRunnable paused yet? If it has been unpaused this will also return true.- Returns:
- true if it is paused, or was previously paused and has been unpaused.
-
waitUntilPaused
void waitUntilPaused() throws InterruptedExceptionBlock the current thread indefinitely, until the PausingRunnable is paused.- Throws:
InterruptedException- if the thread that is waiting is interrupted.
-
waitUntilPaused
boolean waitUntilPaused(long amount, TimeUnit unit) throws InterruptedExceptionBlock the current thread until the PausingRunnable is paused, unless a timeout has expired while waiting. If the timeout expires, this method will return false.- Parameters:
amount- The magnitude of the timeout value.unit- The units of the timeout value.- Returns:
- true if the PausingRunnable paused before the timeout expired, or false if the timeout expired before the PausingRunnable paused.
- Throws:
InterruptedException- if the thread that is waiting is interrupted.
-
unpause
void unpause()
Release a paused PausingRunnable so that it can continue running.
-
hasUnpaused
boolean hasUnpaused()
Has the PausingRunnable been paused and then unpaused?- Returns:
- true if it has been unpaused.
-
-