public class GenericThreadPool extends ThreadPoolExecutor implements ThreadPool
| 限定符和类型 | 类和说明 |
|---|---|
(专用程序包) static class |
GenericThreadPool.ActionFutureTask<R> |
(专用程序包) static class |
GenericThreadPool.DefaultPromise<R> |
(专用程序包) static class |
GenericThreadPool.Reference<R> |
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy| 限定符和类型 | 字段和说明 |
|---|---|
private AtomicInteger |
failedCount |
private Latch |
latch |
private RejectedExecutionHandler |
rejectedExecutionHandler |
private long |
timeout |
private Queue<Runnable> |
waitQueue |
| 构造器和说明 |
|---|
GenericThreadPool(int maxPoolSize,
Latch latch,
long timeout,
int queueSize,
ThreadFactory threadFactory) |
GenericThreadPool(int maxPoolSize,
long timeout,
int queueSize,
ThreadFactory threadFactory) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
afterExecute(Runnable runnable,
Throwable e) |
boolean |
apply(Runnable task) |
void |
execute(Runnable command) |
int |
getActiveThreadSize() |
long |
getFailedTaskCount() |
int |
getIdleThreadSize() |
int |
getMaxPoolSize() |
int |
getQueueSize() |
static void |
main(String[] args) |
void |
setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler) |
void |
shutdown() |
<R> Promise<R> |
submit(Action<R> action) |
String |
toString() |
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, shutdownNow, terminatedinvokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submitgetCompletedTaskCount, getPoolSize, isShutdownprivate final Latch latch
private final long timeout
private final AtomicInteger failedCount
private RejectedExecutionHandler rejectedExecutionHandler
public GenericThreadPool(int maxPoolSize,
long timeout,
int queueSize,
ThreadFactory threadFactory)
public GenericThreadPool(int maxPoolSize,
Latch latch,
long timeout,
int queueSize,
ThreadFactory threadFactory)
public boolean apply(Runnable task)
apply 在接口中 ThreadPoolpublic <R> Promise<R> submit(Action<R> action)
submit 在接口中 ThreadPoolpublic int getMaxPoolSize()
getMaxPoolSize 在接口中 ThreadPoolpublic int getQueueSize()
getQueueSize 在接口中 ThreadPoolpublic int getActiveThreadSize()
getActiveThreadSize 在接口中 ThreadPoolpublic int getIdleThreadSize()
getIdleThreadSize 在接口中 ThreadPoolpublic long getFailedTaskCount()
getFailedTaskCount 在接口中 ThreadPoolpublic void setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler)
setRejectedExecutionHandler 在接口中 ThreadPoolpublic void execute(Runnable command)
execute 在接口中 ThreadPoolexecute 在接口中 Executorexecute 在类中 ThreadPoolExecutorprotected final void afterExecute(Runnable runnable, Throwable e)
afterExecute 在类中 ThreadPoolExecutorpublic void shutdown()
shutdown 在接口中 ThreadPoolshutdown 在接口中 ExecutorServiceshutdown 在类中 ThreadPoolExecutorpublic String toString()
toString 在类中 ThreadPoolExecutorpublic static void main(String[] args) throws IOException
IOExceptionCopyright © 2020. All rights reserved.