Package io.helidon.common.configurable
Class ThreadPool
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- io.helidon.common.configurable.ThreadPool
-
- All Implemented Interfaces:
Executor,ExecutorService
public class ThreadPool extends ThreadPoolExecutor
AThreadPoolExecutorthat adds queue state accessors.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Optional<ThreadPool>asThreadPool(ExecutorService executor)Returns the given executor as aThreadPoolif possible.voidexecute(Runnable command)StringgetName()Returns the name of this pool.intgetPeakQueueSize()Returns the peak queue size.intgetQueueCapacity()Returns the queue capacity.StringtoString()-
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, 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
-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
-
-
-
Method Detail
-
asThreadPool
public static Optional<ThreadPool> asThreadPool(ExecutorService executor)
Returns the given executor as aThreadPoolif possible.- Parameters:
executor- The executor.- Returns:
- The thread pool or empty if not a
ThreadPool.
-
execute
public void execute(Runnable command)
- Specified by:
executein interfaceExecutor- Overrides:
executein classThreadPoolExecutor
-
getName
public String getName()
Returns the name of this pool.- Returns:
- The name.
-
getQueueCapacity
public int getQueueCapacity()
Returns the queue capacity.- Returns:
- The capacity.
-
getPeakQueueSize
public int getPeakQueueSize()
Returns the peak queue size.- Returns:
- The size.
-
toString
public String toString()
- Overrides:
toStringin classThreadPoolExecutor
-
-