Class TeamCityThreadPoolExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- jetbrains.buildServer.util.executors.TeamCityThreadPoolExecutor
-
- All Implemented Interfaces:
Executor,ExecutorService,ExecutorServiceEx
- Direct Known Subclasses:
ScalingThreadPoolExecutor
public class TeamCityThreadPoolExecutor extends ThreadPoolExecutor implements ExecutorServiceEx
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
-
Constructor Summary
Constructors Constructor Description TeamCityThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory)TeamCityThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterExecute(Runnable runnable, Throwable throwable)protected voidbeforeExecute(Thread thread, Runnable runnable)static StringgetName(Object task)intgetQueuedTasksCount()booleanisPaused()protected <T> RunnableFuture<T>newTaskFor(Runnable runnable, T value)protected <T> RunnableFuture<T>newTaskFor(Callable<T> callable)voidpause()voidresume()voidsetPoolSize(int poolSize)Changes the maximum and core pool sizes of the thread pool.voidshutdown()-
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, 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, shutdownNow, terminated, toString
-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdownNow, submit, submit, submit
-
Methods inherited from interface jetbrains.buildServer.util.executors.ExecutorServiceEx
getActiveCount
-
-
-
-
Constructor Detail
-
TeamCityThreadPoolExecutor
public TeamCityThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, @NotNull TimeUnit unit, @NotNull BlockingQueue<Runnable> workQueue, @NotNull ThreadFactory threadFactory, @NotNull RejectedExecutionHandler handler)
-
TeamCityThreadPoolExecutor
public TeamCityThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, @NotNull TimeUnit unit, @NotNull BlockingQueue<Runnable> workQueue, @NotNull ThreadFactory threadFactory)
-
-
Method Detail
-
setPoolSize
public void setPoolSize(int poolSize)
Changes the maximum and core pool sizes of the thread pool. If the current maximum pool size and a core pool size are the same, then new pool size is set to the both maximum and core pool size. If the new pool size is smaller than the core pool size, then the core pool size is reduced to the new pool size value.- Parameters:
poolSize- the new maximum pool size- Since:
- 2022.1
-
beforeExecute
protected void beforeExecute(@NotNull Thread thread, @NotNull Runnable runnable)- Overrides:
beforeExecutein classThreadPoolExecutor
-
pause
public void pause()
-
resume
public void resume()
-
isPaused
public boolean isPaused()
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceExecutorService- Overrides:
shutdownin classThreadPoolExecutor
-
afterExecute
protected void afterExecute(Runnable runnable, Throwable throwable)
- Overrides:
afterExecutein classThreadPoolExecutor
-
newTaskFor
protected <T> RunnableFuture<T> newTaskFor(@NotNull Runnable runnable, T value)
- Overrides:
newTaskForin classAbstractExecutorService
-
newTaskFor
protected <T> RunnableFuture<T> newTaskFor(@NotNull Callable<T> callable)
- Overrides:
newTaskForin classAbstractExecutorService
-
getQueuedTasksCount
public int getQueuedTasksCount()
- Specified by:
getQueuedTasksCountin interfaceExecutorServiceEx- Returns:
- count of tasks in queue (not filtered - some can be cancelled)
-
-