AutoCloseable
, Executor
, ExecutorService
public class AutoCloseableExecutorService extends ThreadPoolExecutor implements AutoCloseable
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
Constructor | Description |
---|---|
AutoCloseableExecutorService(int numThreads) |
A ThreadPoolExecutor that can be used in a try-with-resources block.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
Shut down thread pool on close().
|
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toString
public AutoCloseableExecutorService(int numThreads)
numThreads
- The number of threads to allocate.public void close()
close
in interface AutoCloseable
Copyright © 2018. All rights reserved.