Class WaterMarkExecutor

  • All Implemented Interfaces:
    Executor, ExecutorService

    public class WaterMarkExecutor
    extends ThreadPoolExecutor
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, but the execution happens differently from the ThreadPoolExecutor. In this executor after all the core pool threads are used queuing happens until the water mark. If the more tasks are submitted after the queue is filled up to the water mark the number of threads increases to max. If the number of tasks continue to increase the Queue begins to fill up. If the queue is a bounded queue and the queue is completely filled a RejectedExecutionHandler is executed if one specified. Otherwise the task is rejected.