Class TaskProcessor

java.lang.Object
org.glassfish.tyrus.container.grizzly.client.TaskProcessor

public class TaskProcessor extends Object
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
  • Constructor Details

    • TaskProcessor

      public TaskProcessor(TaskProcessor.Condition condition)
      Constructor.
      Parameters:
      condition - if present, it will be called before processing each TaskProcessor.Task. When TaskProcessor.Condition.isValid() returns false, processing will be terminated. If null, 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

      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.