public class ExecutionQueue
extends java.lang.Object
Runnables and executes them in serial on an
ExecutorService.| Constructor and Description |
|---|
ExecutionQueue(java.util.concurrent.ExecutorService service) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isInQueue() |
void |
pause()
Pause execution of queued
Runnables. |
void |
requireInQueue()
Call to check if the current code is being executed inside this queue.
|
void |
requireInQueue(java.lang.String message)
Call to check if the current code is being executed inside this queue.
|
void |
resume()
Resume execution of queued
Runnables. |
void |
submit(java.lang.Runnable runnable)
Submit a
Runnable to be executed. |
void |
submitToHead(java.lang.Runnable runnable)
Submit a
Runnable to be executed at the head of the queue. |
public ExecutionQueue(java.util.concurrent.ExecutorService service)
public void submit(java.lang.Runnable runnable)
Runnable to be executed.runnable - the Runnable to be executed.public void submitToHead(java.lang.Runnable runnable)
Runnable to be executed at the head of the queue.runnable - the Runnable to be executed.public void pause()
Runnables.public void resume()
Runnables.public void requireInQueue()
java.lang.IllegalStateException - if flow reaches here without going through this queuepublic void requireInQueue(java.lang.String message)
message - The message to use in the thrown exception if the check failsjava.lang.IllegalStateException - if flow reaches here without going through this queuepublic boolean isInQueue()