|
|
|
@ -143,11 +143,6 @@ public class ConcurrentTaskExecutor implements AsyncListenableTaskExecutor, Sche |
|
|
|
* execution callback (which may be a wrapper around the user-supplied task). |
|
|
|
* execution callback (which may be a wrapper around the user-supplied task). |
|
|
|
* <p>The primary use case is to set some execution context around the task's |
|
|
|
* <p>The primary use case is to set some execution context around the task's |
|
|
|
* invocation, or to provide some monitoring/statistics for task execution. |
|
|
|
* invocation, or to provide some monitoring/statistics for task execution. |
|
|
|
* <p><b>NOTE:</b> Exception handling in {@code TaskDecorator} implementations |
|
|
|
|
|
|
|
* is limited to plain {@code Runnable} execution via {@code execute} calls. |
|
|
|
|
|
|
|
* In case of {@code #submit} calls, the exposed {@code Runnable} will be a |
|
|
|
|
|
|
|
* {@code FutureTask} which does not propagate any exceptions; you might |
|
|
|
|
|
|
|
* have to cast it and call {@code Future#get} to evaluate exceptions. |
|
|
|
|
|
|
|
* @since 4.3 |
|
|
|
* @since 4.3 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public final void setTaskDecorator(TaskDecorator taskDecorator) { |
|
|
|
public final void setTaskDecorator(TaskDecorator taskDecorator) { |
|
|
|
@ -188,11 +183,10 @@ public class ConcurrentTaskExecutor implements AsyncListenableTaskExecutor, Sche |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private TaskExecutorAdapter getAdaptedExecutor(Executor concurrentExecutor) { |
|
|
|
private TaskExecutorAdapter getAdaptedExecutor(Executor originalExecutor) { |
|
|
|
if (managedExecutorServiceClass != null && managedExecutorServiceClass.isInstance(concurrentExecutor)) { |
|
|
|
TaskExecutorAdapter adapter = |
|
|
|
return new ManagedTaskExecutorAdapter(concurrentExecutor); |
|
|
|
(managedExecutorServiceClass != null && managedExecutorServiceClass.isInstance(originalExecutor) ? |
|
|
|
} |
|
|
|
new ManagedTaskExecutorAdapter(originalExecutor) : new TaskExecutorAdapter(originalExecutor)); |
|
|
|
TaskExecutorAdapter adapter = new TaskExecutorAdapter(concurrentExecutor); |
|
|
|
|
|
|
|
if (this.taskDecorator != null) { |
|
|
|
if (this.taskDecorator != null) { |
|
|
|
adapter.setTaskDecorator(this.taskDecorator); |
|
|
|
adapter.setTaskDecorator(this.taskDecorator); |
|
|
|
} |
|
|
|
} |
|
|
|
|