ThreadPoolExecutor (Java Platform SE 7 ) (original) (raw)
Modifier and Type
Method and Description
protected void
**[afterExecute](../../../java/util/concurrent/ThreadPoolExecutor.html#afterExecute%28java.lang.Runnable,%20java.lang.Throwable%29)**([Runnable](../../../java/lang/Runnable.html "interface in java.lang") r,[Throwable](../../../java/lang/Throwable.html "class in java.lang") t)
Method invoked upon completion of execution of the given Runnable.
void
**[allowCoreThreadTimeOut](../../../java/util/concurrent/ThreadPoolExecutor.html#allowCoreThreadTimeOut%28boolean%29)**(boolean value)
Sets the policy governing whether core threads may time out and terminate if no tasks arrive within the keep-alive time, being replaced if needed when new tasks arrive.
boolean
**[allowsCoreThreadTimeOut](../../../java/util/concurrent/ThreadPoolExecutor.html#allowsCoreThreadTimeOut%28%29)**()
Returns true if this pool allows core threads to time out and terminate if no tasks arrive within the keepAlive time, being replaced if needed when new tasks arrive.
boolean
**[awaitTermination](../../../java/util/concurrent/ThreadPoolExecutor.html#awaitTermination%28long,%20java.util.concurrent.TimeUnit%29)**(long timeout,[TimeUnit](../../../java/util/concurrent/TimeUnit.html "enum in java.util.concurrent") unit)
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.
protected void
**[beforeExecute](../../../java/util/concurrent/ThreadPoolExecutor.html#beforeExecute%28java.lang.Thread,%20java.lang.Runnable%29)**([Thread](../../../java/lang/Thread.html "class in java.lang") t,[Runnable](../../../java/lang/Runnable.html "interface in java.lang") r)
Method invoked prior to executing the given Runnable in the given thread.
void
**[execute](../../../java/util/concurrent/ThreadPoolExecutor.html#execute%28java.lang.Runnable%29)**([Runnable](../../../java/lang/Runnable.html "interface in java.lang") command)
Executes the given task sometime in the future.
protected void
**[finalize](../../../java/util/concurrent/ThreadPoolExecutor.html#finalize%28%29)**()
Invokes shutdown
when this executor is no longer referenced and it has no threads.
int
**[getActiveCount](../../../java/util/concurrent/ThreadPoolExecutor.html#getActiveCount%28%29)**()
Returns the approximate number of threads that are actively executing tasks.
long
**[getCompletedTaskCount](../../../java/util/concurrent/ThreadPoolExecutor.html#getCompletedTaskCount%28%29)**()
Returns the approximate total number of tasks that have completed execution.
int
**[getCorePoolSize](../../../java/util/concurrent/ThreadPoolExecutor.html#getCorePoolSize%28%29)**()
Returns the core number of threads.
long
**[getKeepAliveTime](../../../java/util/concurrent/ThreadPoolExecutor.html#getKeepAliveTime%28java.util.concurrent.TimeUnit%29)**([TimeUnit](../../../java/util/concurrent/TimeUnit.html "enum in java.util.concurrent") unit)
Returns the thread keep-alive time, which is the amount of time that threads in excess of the core pool size may remain idle before being terminated.
int
**[getLargestPoolSize](../../../java/util/concurrent/ThreadPoolExecutor.html#getLargestPoolSize%28%29)**()
Returns the largest number of threads that have ever simultaneously been in the pool.
int
**[getMaximumPoolSize](../../../java/util/concurrent/ThreadPoolExecutor.html#getMaximumPoolSize%28%29)**()
Returns the maximum allowed number of threads.
int
**[getPoolSize](../../../java/util/concurrent/ThreadPoolExecutor.html#getPoolSize%28%29)**()
Returns the current number of threads in the pool.
[BlockingQueue](../../../java/util/concurrent/BlockingQueue.html "interface in java.util.concurrent")<[Runnable](../../../java/lang/Runnable.html "interface in java.lang")>
**[getQueue](../../../java/util/concurrent/ThreadPoolExecutor.html#getQueue%28%29)**()
Returns the task queue used by this executor.
[RejectedExecutionHandler](../../../java/util/concurrent/RejectedExecutionHandler.html "interface in java.util.concurrent")
**[getRejectedExecutionHandler](../../../java/util/concurrent/ThreadPoolExecutor.html#getRejectedExecutionHandler%28%29)**()
Returns the current handler for unexecutable tasks.
long
**[getTaskCount](../../../java/util/concurrent/ThreadPoolExecutor.html#getTaskCount%28%29)**()
Returns the approximate total number of tasks that have ever been scheduled for execution.
[ThreadFactory](../../../java/util/concurrent/ThreadFactory.html "interface in java.util.concurrent")
**[getThreadFactory](../../../java/util/concurrent/ThreadPoolExecutor.html#getThreadFactory%28%29)**()
Returns the thread factory used to create new threads.
boolean
**[isShutdown](../../../java/util/concurrent/ThreadPoolExecutor.html#isShutdown%28%29)**()
Returns
true
if this executor has been shut down.
boolean
**[isTerminated](../../../java/util/concurrent/ThreadPoolExecutor.html#isTerminated%28%29)**()
Returns
true
if all tasks have completed following shut down.
boolean
**[isTerminating](../../../java/util/concurrent/ThreadPoolExecutor.html#isTerminating%28%29)**()
Returns true if this executor is in the process of terminating after shutdown() or shutdownNow() but has not completely terminated.
int
**[prestartAllCoreThreads](../../../java/util/concurrent/ThreadPoolExecutor.html#prestartAllCoreThreads%28%29)**()
Starts all core threads, causing them to idly wait for work.
boolean
**[prestartCoreThread](../../../java/util/concurrent/ThreadPoolExecutor.html#prestartCoreThread%28%29)**()
Starts a core thread, causing it to idly wait for work.
void
**[purge](../../../java/util/concurrent/ThreadPoolExecutor.html#purge%28%29)**()
Tries to remove from the work queue all Future tasks that have been cancelled.
boolean
**[remove](../../../java/util/concurrent/ThreadPoolExecutor.html#remove%28java.lang.Runnable%29)**([Runnable](../../../java/lang/Runnable.html "interface in java.lang") task)
Removes this task from the executor's internal queue if it is present, thus causing it not to be run if it has not already started.
void
**[setCorePoolSize](../../../java/util/concurrent/ThreadPoolExecutor.html#setCorePoolSize%28int%29)**(int corePoolSize)
Sets the core number of threads.
void
**[setKeepAliveTime](../../../java/util/concurrent/ThreadPoolExecutor.html#setKeepAliveTime%28long,%20java.util.concurrent.TimeUnit%29)**(long time,[TimeUnit](../../../java/util/concurrent/TimeUnit.html "enum in java.util.concurrent") unit)
Sets the time limit for which threads may remain idle before being terminated.
void
**[setMaximumPoolSize](../../../java/util/concurrent/ThreadPoolExecutor.html#setMaximumPoolSize%28int%29)**(int maximumPoolSize)
Sets the maximum allowed number of threads.
void
**[setRejectedExecutionHandler](../../../java/util/concurrent/ThreadPoolExecutor.html#setRejectedExecutionHandler%28java.util.concurrent.RejectedExecutionHandler%29)**([RejectedExecutionHandler](../../../java/util/concurrent/RejectedExecutionHandler.html "interface in java.util.concurrent") handler)
Sets a new handler for unexecutable tasks.
void
**[setThreadFactory](../../../java/util/concurrent/ThreadPoolExecutor.html#setThreadFactory%28java.util.concurrent.ThreadFactory%29)**([ThreadFactory](../../../java/util/concurrent/ThreadFactory.html "interface in java.util.concurrent") threadFactory)
Sets the thread factory used to create new threads.
void
**[shutdown](../../../java/util/concurrent/ThreadPoolExecutor.html#shutdown%28%29)**()
Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.
[List](../../../java/util/List.html "interface in java.util")<[Runnable](../../../java/lang/Runnable.html "interface in java.lang")>
**[shutdownNow](../../../java/util/concurrent/ThreadPoolExecutor.html#shutdownNow%28%29)**()
Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution.
protected void
**[terminated](../../../java/util/concurrent/ThreadPoolExecutor.html#terminated%28%29)**()
Method invoked when the Executor has terminated.
[String](../../../java/lang/String.html "class in java.lang")
**[toString](../../../java/util/concurrent/ThreadPoolExecutor.html#toString%28%29)**()
Returns a string identifying this pool, as well as its state, including indications of run state and estimated worker and task counts.