Class SerialExecutionQueue<T>
- java.lang.Object
-
- com.inductiveautomation.ignition.common.util.SerialExecutionQueue<T>
-
- Type Parameters:
T
- Submitted item type.
public class SerialExecutionQueue<T> extends java.lang.Object
Queues up submitted items and executes them in serial on an ExecutorService.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SerialExecutionQueue.ExecutionCallback<T>
static class
SerialExecutionQueue.RunnableExecutor
AnSerialExecutionQueue.ExecutionCallback
that executesRunnable
s.
-
Field Summary
Fields Modifier and Type Field Description static SerialExecutionQueue.RunnableExecutor
RUNNABLE_EXECUTOR
-
Constructor Summary
Constructors Constructor Description SerialExecutionQueue(SerialExecutionQueue.ExecutionCallback<T> callback, java.util.concurrent.ExecutorService service)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> SerialExecutionQueue.ExecutionCallback<T>
noOpCallback()
void
pause()
Pause evaluation of items in the queue.void
resume()
Resume evaluation of items in the queue.int
size()
void
submit(T item)
Submit an item to be delivered to the callback when it's time to execute.void
submitToHead(T item)
Submit an item at the head of the queue to be delivered to the callback when it's time to execute.
-
-
-
Field Detail
-
RUNNABLE_EXECUTOR
public static final SerialExecutionQueue.RunnableExecutor RUNNABLE_EXECUTOR
-
-
Constructor Detail
-
SerialExecutionQueue
public SerialExecutionQueue(SerialExecutionQueue.ExecutionCallback<T> callback, java.util.concurrent.ExecutorService service)
-
-
Method Detail
-
submit
public void submit(T item)
Submit an item to be delivered to the callback when it's time to execute.- Parameters:
item
- Item to be delivered.
-
submitToHead
public void submitToHead(T item)
Submit an item at the head of the queue to be delivered to the callback when it's time to execute.- Parameters:
item
- Item to be delivered.
-
pause
public void pause()
Pause evaluation of items in the queue.
-
resume
public void resume()
Resume evaluation of items in the queue.
-
size
public int size()
-
noOpCallback
public static <T> SerialExecutionQueue.ExecutionCallback<T> noOpCallback()
-
-