Class BlockingTaskQueue
java.lang.Object
com.inductiveautomation.perspective.gateway.threading.BlockingTaskQueue
Helps to manage threading for a series of tasks. These tasks are blocking tasks that may produce a value (T) and
 ideally can gracefully handle being cancelled.
 
This class will guarantee:
- Only one task executes at a time.
- All tasks execute on the executor given.
-  Tasks will have their BlockingCancelableTask.cancel()called if they exceed the configured timeout, and their completion stage will be completed exceptionally with aTaskTimedOutException
-  Tasks submitted while other tasks are executing are put into a queue. If the queue fills up, the oldest
 tasks are rejected first. Rejected tasks will have their completion stages completed exceptionally with a
 QueueOverflowException
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classstatic enum
- 
Method SummaryModifier and TypeMethodDescriptionstatic BlockingTaskQueue.BuilderCreate a new blocking task queue builder with a default of 30 second timeout and max queue length of 5voidshutdown()Shuts down the queue.<T> CompletionStage<T>submit(BlockingCancelableTask<T> work) Submit a task to the queue.
- 
Method Details- 
submitSubmit a task to the queue.- Returns:
- CompletionStage that will be completed with the return value of type T produced by the task, or completed exceptionally if the task times out, the task is kicked out of the queue by more tasks, or the task throws an exception during execution.
- Throws:
- QueueShutdownException- if this queue has been shutdown.
 
- 
shutdownpublic void shutdown()Shuts down the queue. Any excuting or pending tasks will be canceled, their completion stages completed exceptionally with aQueueShutdownException.
- 
newBuilderCreate a new blocking task queue builder with a default of 30 second timeout and max queue length of 5
 
-