Class TaskBatcher.BatchedTask

  • All Implemented Interfaces:
    java.lang.Comparable<PrioritizedRunnable>, java.lang.Runnable
    Enclosing class:
    TaskBatcher

    protected abstract class TaskBatcher.BatchedTask
    extends SourcePrioritizedRunnable
    Represents a runnable task that supports batching. Implementors of TaskBatcher can subclass this to add a payload to the task.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Object batchingKey
      the object that is used as batching key
      protected java.util.concurrent.atomic.AtomicBoolean processed
      whether the task has been processed already
      protected java.lang.Object task
      the task object that is wrapped
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected BatchedTask​(Priority priority, java.lang.String source, java.lang.Object batchingKey, java.lang.Object task)  
    • Field Detail

      • processed

        protected final java.util.concurrent.atomic.AtomicBoolean processed
        whether the task has been processed already
      • batchingKey

        protected final java.lang.Object batchingKey
        the object that is used as batching key
      • task

        protected final java.lang.Object task
        the task object that is wrapped
    • Constructor Detail

      • BatchedTask

        protected BatchedTask​(Priority priority,
                              java.lang.String source,
                              java.lang.Object batchingKey,
                              java.lang.Object task)
    • Method Detail

      • run

        public void run()
      • describeTasks

        public abstract java.lang.String describeTasks​(java.util.List<? extends TaskBatcher.BatchedTask> tasks)
      • getTask

        public java.lang.Object getTask()