Class TaskProcessor
java.lang.Object
org.glassfish.tyrus.container.grizzly.client.TaskProcessor
A class responsible for processing
TaskProcessor.Task. It ensures that only one task will be processed at a time, because
Grizzly Worker-thread IOStrategy does not wait until one message is processed before dispatching another one.- Author:
- Pavel Bucek, Petr Janouch
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCondition used inprocessTask(org.glassfish.tyrus.container.grizzly.client.TaskProcessor.Task).static classGeneric task representation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidProcess as much tasks from task queue as possible.voidAdd a task to the task queue and process as much tasks from the task queue as possible.
-
Constructor Details
-
TaskProcessor
Constructor.- Parameters:
condition- if present, it will be called before processing eachTaskProcessor.Task. WhenTaskProcessor.Condition.isValid()returnsfalse, processing will be terminated. Ifnull, all tasks from the queue will be processed.
-
TaskProcessor
public TaskProcessor()Constructor.There is no condition that has to be checked before processing each task.
-
-
Method Details
-
processTask
Add a task to the task queue and process as much tasks from the task queue as possible.- Parameters:
task-TaskProcessor.Taskthat should be processed.
-
processTask
public void processTask()Process as much tasks from task queue as possible.
-