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 int
DEFAULT_CORE_POOL_SIZE
static long
DEFAULT_KEEP_ALIVE_SECONDS
static int
DEFAULT_MAXIMUM_POOL_SIZE
static java.lang.String
DEFAULT_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 void
afterExecute(java.lang.Runnable task, java.lang.Throwable ex)
protected void
beforeExecute(java.lang.Thread worker, java.lang.Runnable task)
static ThreadPool
create()
static ThreadPool
create(java.lang.String description)
static ThreadPool
create(java.lang.String threadGroupName, int corePoolSize, int maximumPoolSize, long keepAliveSeconds)
int
getActiveCount()
java.util.concurrent.RejectedExecutionHandler
getRejectedExecutionHandler()
protected void
potentialDeadlockDetected()
void
rejectedExecution(java.lang.Runnable task, java.util.concurrent.ThreadPoolExecutor executor)
void
setRejectedExecutionHandler(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:
setRejectedExecutionHandler
in classjava.util.concurrent.ThreadPoolExecutor
-
getRejectedExecutionHandler
public java.util.concurrent.RejectedExecutionHandler getRejectedExecutionHandler()
- Overrides:
getRejectedExecutionHandler
in classjava.util.concurrent.ThreadPoolExecutor
-
rejectedExecution
public void rejectedExecution(java.lang.Runnable task, java.util.concurrent.ThreadPoolExecutor executor)
- Specified by:
rejectedExecution
in interfacejava.util.concurrent.RejectedExecutionHandler
-
getActiveCount
public int getActiveCount()
- Overrides:
getActiveCount
in classjava.util.concurrent.ThreadPoolExecutor
-
beforeExecute
protected void beforeExecute(java.lang.Thread worker, java.lang.Runnable task)
- Overrides:
beforeExecute
in classjava.util.concurrent.ThreadPoolExecutor
-
afterExecute
protected void afterExecute(java.lang.Runnable task, java.lang.Throwable ex)
- Overrides:
afterExecute
in 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)
-
-