接口 TaskDecorator
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
A callback interface for a decorator to be applied to any
Runnable
about to be executed.
Note that such a decorator is not necessarily being applied to the
user-supplied Runnable/Callable but rather to the actual
execution callback (which may be a wrapper around the user-supplied task).
The primary use case is to set some execution context around the task's invocation, or to provide some monitoring/statistics for task execution.
NOTE: Exception handling in TaskDecorator implementations
may be limited. Specifically in case of a Future-based operation,
the exposed Runnable will be a wrapper which does not propagate
any exceptions from its run method.
-
方法概要
修饰符和类型方法说明Decorate the givenRunnable, returning a potentially wrappedRunnablefor actual execution, internally delegating to the originalRunnable.run()implementation.
-
方法详细资料
-
decorate
Decorate the givenRunnable, returning a potentially wrappedRunnablefor actual execution, internally delegating to the originalRunnable.run()implementation.- 参数:
runnable- the originalRunnable- 返回:
- the decorated
Runnable
-