|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2020 the original author or authors. |
|
|
|
* Copyright 2002-2022 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -33,7 +33,6 @@ import org.springframework.beans.factory.InitializingBean; |
|
|
|
import org.springframework.core.task.AsyncListenableTaskExecutor; |
|
|
|
import org.springframework.core.task.AsyncListenableTaskExecutor; |
|
|
|
import org.springframework.core.task.TaskDecorator; |
|
|
|
import org.springframework.core.task.TaskDecorator; |
|
|
|
import org.springframework.core.task.TaskRejectedException; |
|
|
|
import org.springframework.core.task.TaskRejectedException; |
|
|
|
import org.springframework.core.task.TaskTimeoutException; |
|
|
|
|
|
|
|
import org.springframework.jca.context.BootstrapContextAware; |
|
|
|
import org.springframework.jca.context.BootstrapContextAware; |
|
|
|
import org.springframework.jndi.JndiLocatorSupport; |
|
|
|
import org.springframework.jndi.JndiLocatorSupport; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
@ -218,11 +217,13 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport |
|
|
|
// Implementation of the Spring SchedulingTaskExecutor interface
|
|
|
|
// Implementation of the Spring SchedulingTaskExecutor interface
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void execute(Runnable task) { |
|
|
|
public void execute(Runnable task) { |
|
|
|
execute(task, TIMEOUT_INDEFINITE); |
|
|
|
execute(task, TIMEOUT_INDEFINITE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Deprecated |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void execute(Runnable task, long startTimeout) { |
|
|
|
public void execute(Runnable task, long startTimeout) { |
|
|
|
Work work = new DelegatingWork(this.taskDecorator != null ? this.taskDecorator.decorate(task) : task); |
|
|
|
Work work = new DelegatingWork(this.taskDecorator != null ? this.taskDecorator.decorate(task) : task); |
|
|
|
@ -254,7 +255,8 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport |
|
|
|
} |
|
|
|
} |
|
|
|
catch (WorkRejectedException ex) { |
|
|
|
catch (WorkRejectedException ex) { |
|
|
|
if (WorkException.START_TIMED_OUT.equals(ex.getErrorCode())) { |
|
|
|
if (WorkException.START_TIMED_OUT.equals(ex.getErrorCode())) { |
|
|
|
throw new TaskTimeoutException("JCA WorkManager rejected task because of timeout: " + task, ex); |
|
|
|
throw new org.springframework.core.task.TaskTimeoutException( |
|
|
|
|
|
|
|
"JCA WorkManager rejected task because of timeout: " + task, ex); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
throw new TaskRejectedException("JCA WorkManager rejected task: " + task, ex); |
|
|
|
throw new TaskRejectedException("JCA WorkManager rejected task: " + task, ex); |
|
|
|
@ -265,6 +267,7 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Future<?> submit(Runnable task) { |
|
|
|
public Future<?> submit(Runnable task) { |
|
|
|
FutureTask<Object> future = new FutureTask<>(task, null); |
|
|
|
FutureTask<Object> future = new FutureTask<>(task, null); |
|
|
|
@ -272,6 +275,7 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport |
|
|
|
return future; |
|
|
|
return future; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public <T> Future<T> submit(Callable<T> task) { |
|
|
|
public <T> Future<T> submit(Callable<T> task) { |
|
|
|
FutureTask<T> future = new FutureTask<>(task); |
|
|
|
FutureTask<T> future = new FutureTask<>(task); |
|
|
|
@ -279,6 +283,7 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport |
|
|
|
return future; |
|
|
|
return future; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public ListenableFuture<?> submitListenable(Runnable task) { |
|
|
|
public ListenableFuture<?> submitListenable(Runnable task) { |
|
|
|
ListenableFutureTask<Object> future = new ListenableFutureTask<>(task, null); |
|
|
|
ListenableFutureTask<Object> future = new ListenableFutureTask<>(task, null); |
|
|
|
@ -286,6 +291,7 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport |
|
|
|
return future; |
|
|
|
return future; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public <T> ListenableFuture<T> submitListenable(Callable<T> task) { |
|
|
|
public <T> ListenableFuture<T> submitListenable(Callable<T> task) { |
|
|
|
ListenableFutureTask<T> future = new ListenableFutureTask<>(task); |
|
|
|
ListenableFutureTask<T> future = new ListenableFutureTask<>(task); |
|
|
|
|