Package com.suse.common.concurrent
Class UnboundedGrowingThreadPoolExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
com.suse.common.concurrent.UnboundedGrowingThreadPoolExecutor
- All Implemented Interfaces:
Executor,ExecutorService
A
ThreadPoolExecutor that increases the threads in the pool even if the queue is not full.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classCustom handler of the rejection event to make sure the rejected item are put back to the queueprivate static classA blocking queue implementation that always tries to transfer the items offeredNested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionUnboundedGrowingThreadPoolExecutor(int corePoolSize, int maximumPoolSize, Duration keepAlive, String threadNamePrefix) Default constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidMethods inherited from class java.util.concurrent.ThreadPoolExecutor
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, setThreadFactory, shutdown, shutdownNow, terminated, toStringMethods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
Field Details
-
CURRENT_ID
-
handler
-
-
Constructor Details
-
UnboundedGrowingThreadPoolExecutor
public UnboundedGrowingThreadPoolExecutor(int corePoolSize, int maximumPoolSize, Duration keepAlive, String threadNamePrefix) Default constructor- Parameters:
corePoolSize- the number of core threadsmaximumPoolSize- the maximum number of threads to allow in the poolkeepAlive- when the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating.threadNamePrefix- the prefix to use for the name of the threads part of the pool
-
-
Method Details
-
setRejectedExecutionHandler
- Overrides:
setRejectedExecutionHandlerin classThreadPoolExecutor
-