Class ThreadPool
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- org.eclipse.net4j.util.concurrent.ThreadPool
-
- All Implemented Interfaces:
java.util.concurrent.Executor,java.util.concurrent.ExecutorService,java.util.concurrent.RejectedExecutionHandler
public class ThreadPool extends java.util.concurrent.ThreadPoolExecutor implements java.util.concurrent.RejectedExecutionHandler- Since:
- 3.6
- Author:
- Eike Stepper
-
-
Nested Class Summary
-
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 static intDEFAULT_CORE_POOL_SIZEstatic longDEFAULT_KEEP_ALIVE_SECONDSstatic intDEFAULT_MAXIMUM_POOL_SIZEstatic java.lang.StringDEFAULT_THREAD_GROUP_NAME
-
Constructor Summary
Constructors Constructor Description ThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.ThreadFactory threadFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterExecute(java.lang.Runnable task, java.lang.Throwable ex)protected voidbeforeExecute(java.lang.Thread worker, java.lang.Runnable task)static ThreadPoolcreate()static ThreadPoolcreate(java.lang.String description)static ThreadPoolcreate(java.lang.String threadGroupName, int corePoolSize, int maximumPoolSize, long keepAliveSeconds)intgetActiveCount()java.util.concurrent.RejectedExecutionHandlergetRejectedExecutionHandler()protected voidpotentialDeadlockDetected()voidrejectedExecution(java.lang.Runnable task, java.util.concurrent.ThreadPoolExecutor executor)voidsetRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler handler)-
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, execute, finalize, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setThreadFactory, shutdown, shutdownNow, terminated, toString
-
-
-
-
Field Detail
-
DEFAULT_THREAD_GROUP_NAME
public static final java.lang.String DEFAULT_THREAD_GROUP_NAME
- See Also:
- Constant Field Values
-
DEFAULT_CORE_POOL_SIZE
public static final int DEFAULT_CORE_POOL_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_MAXIMUM_POOL_SIZE
public static final int DEFAULT_MAXIMUM_POOL_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_KEEP_ALIVE_SECONDS
public static final long DEFAULT_KEEP_ALIVE_SECONDS
- See Also:
- Constant Field Values
-
-
Method Detail
-
setRejectedExecutionHandler
public void setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler handler)
- Overrides:
setRejectedExecutionHandlerin classjava.util.concurrent.ThreadPoolExecutor
-
getRejectedExecutionHandler
public java.util.concurrent.RejectedExecutionHandler getRejectedExecutionHandler()
- Overrides:
getRejectedExecutionHandlerin classjava.util.concurrent.ThreadPoolExecutor
-
rejectedExecution
public void rejectedExecution(java.lang.Runnable task, java.util.concurrent.ThreadPoolExecutor executor)- Specified by:
rejectedExecutionin interfacejava.util.concurrent.RejectedExecutionHandler
-
getActiveCount
public int getActiveCount()
- Overrides:
getActiveCountin classjava.util.concurrent.ThreadPoolExecutor
-
beforeExecute
protected void beforeExecute(java.lang.Thread worker, java.lang.Runnable task)- Overrides:
beforeExecutein classjava.util.concurrent.ThreadPoolExecutor
-
afterExecute
protected void afterExecute(java.lang.Runnable task, java.lang.Throwable ex)- Overrides:
afterExecutein classjava.util.concurrent.ThreadPoolExecutor
-
potentialDeadlockDetected
protected void potentialDeadlockDetected()
- Since:
- 3.9
-
create
public static ThreadPool create()
-
create
public static ThreadPool create(java.lang.String description)
-
create
public static ThreadPool create(java.lang.String threadGroupName, int corePoolSize, int maximumPoolSize, long keepAliveSeconds)
-
-