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
Modifier and TypeClassDescriptionstatic interface
Condition used inprocessTask(org.glassfish.tyrus.container.grizzly.client.TaskProcessor.Task)
.static class
Generic task representation. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Process as much tasks from task queue as possible.void
Add 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.Task
that should be processed.
-
processTask
public void processTask()Process as much tasks from task queue as possible.
-