public class AsyncExecutor extends ThreadPoolExecutor implements RejectedExecutionHandler
Instances of this class are created and managed by Tasks
. This class is only made public so it can be
accessed for statistical reasons like (getBlocked()
or getDropped()
.
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
Modifier and Type | Field and Description |
---|---|
protected Average |
duration |
protected Counter |
executed |
Modifier and Type | Method and Description |
---|---|
double |
getAverageDuration()
The average duration of a task in milliseconds.
|
long |
getBlocked()
The number of tasks which were executed by blocking the caller due to system overload conditions.
|
String |
getCategory()
Returns the category this executor was created for.
|
long |
getDropped()
The number of tasks dropped due to system overload conditions.
|
long |
getExecuted()
The number of tasks which were executed by this executor
|
void |
rejectedExecution(Runnable r,
ThreadPoolExecutor executor) |
String |
toString() |
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
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor)
rejectedExecution
in interface RejectedExecutionHandler
public String toString()
toString
in class ThreadPoolExecutor
public String getCategory()
public long getExecuted()
public double getAverageDuration()
public long getBlocked()
A system overload occurs if all available tasks are busy and the queue of this executor reached its limit.
public long getDropped()
A system overload occurs if all available tasks are busy and the queue of this executor reached its limit. If a task has a dropHandler attached, the handler is informed and the task is not executed by simply deleted.
Copyright © 2018. All rights reserved.