类 ContextPropagatingTaskDecorator
java.lang.Object
cn.taketoday.core.task.support.ContextPropagatingTaskDecorator
- 所有已实现的接口:
Decorator<Runnable>,TaskDecorator
TaskDecorator that wrap the execution of
tasks, assisting with context propagation.
This operation is only useful when the task execution is scheduled on a different
thread than the original call stack; this depends on the choice of
TaskExecutor. This is particularly useful for
restoring a logging context or an observation context for the task execution. Note that
this decorator will cause some overhead for task execution and is not recommended for
applications that run lots of very small tasks.
- 从以下版本开始:
- 4.0 2023/9/3 12:53
- 作者:
- Brian Clozel, Harry Yang
- 另请参阅:
-
字段概要
字段 -
构造器概要
构造器构造器说明Create a new decorator that uses a default instance of theContextSnapshotFactory.ContextPropagatingTaskDecorator(io.micrometer.context.ContextSnapshotFactory factory) Create a new decorator using the givenContextSnapshotFactory. -
方法概要
修饰符和类型方法说明Decorate the givenRunnable, returning a potentially wrappedRunnablefor actual execution, internally delegating to the originalRunnable.run()implementation.
-
字段详细资料
-
factory
private final io.micrometer.context.ContextSnapshotFactory factory
-
-
构造器详细资料
-
ContextPropagatingTaskDecorator
public ContextPropagatingTaskDecorator()Create a new decorator that uses a default instance of theContextSnapshotFactory. -
ContextPropagatingTaskDecorator
public ContextPropagatingTaskDecorator(io.micrometer.context.ContextSnapshotFactory factory) Create a new decorator using the givenContextSnapshotFactory.- 参数:
factory- the context snapshot factory to use.
-
-
方法详细资料
-
decorate
从接口复制的说明:TaskDecoratorDecorate the givenRunnable, returning a potentially wrappedRunnablefor actual execution, internally delegating to the originalRunnable.run()implementation.- 指定者:
decorate在接口中Decorator<Runnable>- 指定者:
decorate在接口中TaskDecorator- 参数:
runnable- the originalRunnable- 返回:
- the decorated
Runnable
-