Package org.eclipse.net4j.util.concurrent

# Class ThreadPool

java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
org.eclipse.net4j.util.concurrent.ThreadPool

All Implemented Interfaces:
  `AutoCloseable`, `Executor`, `ExecutorService`, `RejectedExecutionHandler`

public class ThreadPool extends ThreadPoolExecutor implements RejectedExecutionHandler

Since:
  3.6
Author:
  Eike Stepper

## Nested Class Summary

## Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor

`ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`DEFAULT_CORE_POOL_SIZE`
`static final long`
`DEFAULT_KEEP_ALIVE_SECONDS`
`static final int`
`DEFAULT_MAXIMUM_POOL_SIZE`
`static final String`
`DEFAULT_THREAD_GROUP_NAME`

## Constructor Summary

Constructors
Constructor
Description
`ThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveSeconds, ThreadFactory threadFactory)`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`afterExecute(Runnable task, Throwable ex)`
`protected void`
`beforeExecute(Thread worker, Runnable task)`
`static ThreadPool`
`create()`
`static ThreadPool`
`create(String description)`
`static ThreadPool`
`create(String threadGroupName, int corePoolSize, int maximumPoolSize, long keepAliveSeconds)`
`int`
`getActiveCount()`
`RejectedExecutionHandler`
`getRejectedExecutionHandler()`
`protected void`
`potentialDeadlockDetected()`
`void`
`rejectedExecution(Runnable task, ThreadPoolExecutor executor)`
`void`
`setRejectedExecutionHandler(RejectedExecutionHandler handler)`
`protected void`
`terminated()`

### 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, toString`

### Methods inherited from class java.util.concurrent.AbstractExecutorService

`invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, 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

`close`

## Field Details

### DEFAULT_THREAD_GROUP_NAME

public static final 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

### DEFAULT_KEEP_ALIVE_SECONDS

public static final long DEFAULT_KEEP_ALIVE_SECONDS

See Also:
  - Constant Field Values

## Constructor Details

### ThreadPool

public ThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveSeconds, ThreadFactory threadFactory)

## Method Details

### setRejectedExecutionHandler

public void setRejectedExecutionHandler(RejectedExecutionHandler handler)

Overrides:
  `setRejectedExecutionHandler` in class `ThreadPoolExecutor`

### getRejectedExecutionHandler

public RejectedExecutionHandler getRejectedExecutionHandler()

Overrides:
  `getRejectedExecutionHandler` in class `ThreadPoolExecutor`

### rejectedExecution

public void rejectedExecution(Runnable task, ThreadPoolExecutor executor)

Specified by:
  `rejectedExecution` in interface `RejectedExecutionHandler`

### getActiveCount

public int getActiveCount()

Overrides:
  `getActiveCount` in class `ThreadPoolExecutor`

### beforeExecute

protected void beforeExecute(Thread worker, Runnable task)

Overrides:
  `beforeExecute` in class `ThreadPoolExecutor`

### afterExecute

protected void afterExecute(Runnable task, Throwable ex)

Overrides:
  `afterExecute` in class `ThreadPoolExecutor`

### terminated

protected void terminated()

Overrides:
  `terminated` in class `ThreadPoolExecutor`

### potentialDeadlockDetected

protected void potentialDeadlockDetected()

Since:
  3.9

### create

public static ThreadPool create()

### create

public static ThreadPool create(String description)

### create

public static ThreadPool create(String threadGroupName, int corePoolSize, int maximumPoolSize, long keepAliveSeconds)