Class TaskProcessor
- java.lang.Object
-
- org.glassfish.tyrus.container.grizzly.client.TaskProcessor
-
public class TaskProcessor extends java.lang.Object
A class responsible for processingTaskProcessor.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 Classes Modifier and Type Class Description static interface
TaskProcessor.Condition
Condition used inprocessTask(org.glassfish.tyrus.container.grizzly.client.TaskProcessor.Task)
.static class
TaskProcessor.Task
Generic task representation.
-
Constructor Summary
Constructors Constructor Description TaskProcessor()
Constructor.TaskProcessor(TaskProcessor.Condition condition)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
processTask()
Process as much tasks from task queue as possible.void
processTask(TaskProcessor.Task task)
Add a task to the task queue and process as much tasks from the task queue as possible.
-
-
-
Constructor Detail
-
TaskProcessor
public TaskProcessor(TaskProcessor.Condition condition)
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 Detail
-
processTask
public void processTask(TaskProcessor.Task task)
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.
-
-