Class PrioritizedThrottledTaskRunner<T extends Comparable<T> & Runnable>

java.lang.Object
org.elasticsearch.common.util.concurrent.PrioritizedThrottledTaskRunner<T>

public class PrioritizedThrottledTaskRunner<T extends Comparable<T> & Runnable> extends Object
PrioritizedThrottledTaskRunner performs the enqueued tasks in the order dictated by the natural ordering of the tasks, limiting the max number of concurrently running tasks. Each new task that is dequeued to be run, is forked off to the given executor.
  • Constructor Details

    • PrioritizedThrottledTaskRunner

      public PrioritizedThrottledTaskRunner(String name, int maxRunningTasks, Executor executor)
  • Method Details

    • enqueueTask

      public void enqueueTask(T task)
    • pollAndSpawn

      protected void pollAndSpawn()
    • runningTasks

      public int runningTasks()
    • queueSize

      public int queueSize()