public class WaterMarkExecutor extends ThreadPoolExecutor
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.ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
Constructor and Description |
---|
WaterMarkExecutor(int core,
int max,
long keepAlive,
TimeUnit timeUnit,
WaterMarkQueue<Runnable> queue) |
WaterMarkExecutor(int core,
int max,
long keepAlive,
TimeUnit timeUnit,
WaterMarkQueue<Runnable> queue,
RejectedExecutionHandler rejectedExecutionHandler) |
WaterMarkExecutor(int core,
int max,
long keepAlive,
TimeUnit timeUnit,
WaterMarkQueue<Runnable> queue,
ThreadFactory threadFactory) |
WaterMarkExecutor(int core,
int max,
long keepAlive,
TimeUnit timeUnit,
WaterMarkQueue<Runnable> queue,
ThreadFactory threadFactory,
RejectedExecutionHandler rejectedExecutionHandler) |
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toString
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
public WaterMarkExecutor(int core, int max, long keepAlive, TimeUnit timeUnit, WaterMarkQueue<Runnable> queue)
public WaterMarkExecutor(int core, int max, long keepAlive, TimeUnit timeUnit, WaterMarkQueue<Runnable> queue, ThreadFactory threadFactory)
public WaterMarkExecutor(int core, int max, long keepAlive, TimeUnit timeUnit, WaterMarkQueue<Runnable> queue, RejectedExecutionHandler rejectedExecutionHandler)
public WaterMarkExecutor(int core, int max, long keepAlive, TimeUnit timeUnit, WaterMarkQueue<Runnable> queue, ThreadFactory threadFactory, RejectedExecutionHandler rejectedExecutionHandler)
Copyright © 2004–2019 The Apache Software Foundation. All rights reserved.