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:
java.util.concurrent.Executor,java.util.concurrent.ExecutorService
public class UnboundedGrowingThreadPoolExecutor extends java.util.concurrent.ThreadPoolExecutorAThreadPoolExecutorthat increases the threads in the pool even if the queue is not full.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classUnboundedGrowingThreadPoolExecutor.PutBackExecutionHandlerCustom handler of the rejection event to make sure the rejected item are put back to the queueprivate static classUnboundedGrowingThreadPoolExecutor.TransferOnOfferBlockingQueueA blocking queue implementation that always tries to transfer the items offered-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.concurrent.atomic.AtomicIntegerCURRENT_IDprivate UnboundedGrowingThreadPoolExecutor.PutBackExecutionHandlerhandler
-
Constructor Summary
Constructors Constructor Description UnboundedGrowingThreadPoolExecutor(int corePoolSize, int maximumPoolSize, java.time.Duration keepAlive, java.lang.String threadNamePrefix)Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler handlerIn)-
Methods 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, toString
-
-
-
-
Field Detail
-
CURRENT_ID
private static final java.util.concurrent.atomic.AtomicInteger CURRENT_ID
-
handler
private final UnboundedGrowingThreadPoolExecutor.PutBackExecutionHandler handler
-
-
Constructor Detail
-
UnboundedGrowingThreadPoolExecutor
public UnboundedGrowingThreadPoolExecutor(int corePoolSize, int maximumPoolSize, java.time.Duration keepAlive, java.lang.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
-
-