public abstract class AbstractTaskTimerPlugin extends Object implements ExecuteAwarePlugin
An abstract task execution time recording plugin for thread-safe statistics the execution time of tasks.
Must override processTaskTime(long) to define the processing logic for task execution time.
Default time precision is milliseconds, may override currentTime() to redefine the time precision.
| 构造器和说明 |
|---|
AbstractTaskTimerPlugin() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
afterExecute(Runnable runnable,
Throwable throwable)
Record the total time for the worker thread to complete the task, and update the time record.
|
void |
beforeExecute(Thread thread,
Runnable runnable)
Record the time when the worker thread starts executing the task.
|
protected long |
currentTime()
Get the current time.
|
protected abstract void |
processTaskTime(long taskExecuteTime)
Processing the execution time of the task.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetId, getPluginRuntime, start, stoppublic final void beforeExecute(Thread thread, Runnable runnable)
beforeExecute 在接口中 ExecuteAwarePluginthread - thread of executing taskrunnable - taskExtensibleThreadPoolExecutor.beforeExecute(java.lang.Thread, java.lang.Runnable)public final void afterExecute(Runnable runnable, Throwable throwable)
afterExecute 在接口中 ExecuteAwarePluginrunnable - runnablethrowable - exception thrown during executionExtensibleThreadPoolExecutor.afterExecute(java.lang.Runnable, java.lang.Throwable)protected long currentTime()
protected abstract void processTaskTime(long taskExecuteTime)
taskExecuteTime - execute time of taskCopyright © 2022. All rights reserved.