public class ThreadPool
extends java.util.concurrent.ThreadPoolExecutor
implements java.util.concurrent.RejectedExecutionHandler
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
Modifier and Type | Field and 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 and Description |
---|
ThreadPool(int corePoolSize,
int maximumPoolSize,
long keepAliveTime,
java.util.concurrent.ThreadFactory threadFactory) |
Modifier and Type | Method and 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) |
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
public static final java.lang.String DEFAULT_THREAD_GROUP_NAME
public static final int DEFAULT_CORE_POOL_SIZE
public static final int DEFAULT_MAXIMUM_POOL_SIZE
public static final long DEFAULT_KEEP_ALIVE_SECONDS
public ThreadPool(int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.ThreadFactory threadFactory)
public void setRejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler handler)
setRejectedExecutionHandler
in class java.util.concurrent.ThreadPoolExecutor
public java.util.concurrent.RejectedExecutionHandler getRejectedExecutionHandler()
getRejectedExecutionHandler
in class java.util.concurrent.ThreadPoolExecutor
public void rejectedExecution(java.lang.Runnable task, java.util.concurrent.ThreadPoolExecutor executor)
rejectedExecution
in interface java.util.concurrent.RejectedExecutionHandler
public int getActiveCount()
getActiveCount
in class java.util.concurrent.ThreadPoolExecutor
protected void beforeExecute(java.lang.Thread worker, java.lang.Runnable task)
beforeExecute
in class java.util.concurrent.ThreadPoolExecutor
protected void afterExecute(java.lang.Runnable task, java.lang.Throwable ex)
afterExecute
in class java.util.concurrent.ThreadPoolExecutor
protected void potentialDeadlockDetected()
public static ThreadPool create()
public static ThreadPool create(java.lang.String description)
public static ThreadPool create(java.lang.String threadGroupName, int corePoolSize, int maximumPoolSize, long keepAliveSeconds)
Copyright (c) 2004-2019 Eike Stepper (Loehne, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html