|
|
|
@ -27,6 +27,8 @@ import java.util.concurrent.ScheduledFuture; |
|
|
|
import java.util.concurrent.ScheduledThreadPoolExecutor; |
|
|
|
import java.util.concurrent.ScheduledThreadPoolExecutor; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.context.ApplicationContext; |
|
|
|
import org.springframework.context.ApplicationContext; |
|
|
|
import org.springframework.context.ApplicationContextAware; |
|
|
|
import org.springframework.context.ApplicationContextAware; |
|
|
|
import org.springframework.context.ApplicationListener; |
|
|
|
import org.springframework.context.ApplicationListener; |
|
|
|
@ -191,12 +193,21 @@ public class SimpleAsyncTaskScheduler extends SimpleAsyncTaskExecutor implements |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Runnable taskOnSchedulerThread(Runnable task) { |
|
|
|
|
|
|
|
return new DelegatingErrorHandlingRunnable(task, TaskUtils.getDefaultErrorHandler(true)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Runnable scheduledTask(Runnable task) { |
|
|
|
private Runnable scheduledTask(Runnable task) { |
|
|
|
return () -> execute(new DelegatingErrorHandlingRunnable(task, TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER)); |
|
|
|
return () -> execute(new DelegatingErrorHandlingRunnable(task, this::shutdownAwareErrorHandler)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Runnable taskOnSchedulerThread(Runnable task) { |
|
|
|
private void shutdownAwareErrorHandler(Throwable ex) { |
|
|
|
return new DelegatingErrorHandlingRunnable(task, TaskUtils.getDefaultErrorHandler(true)); |
|
|
|
if (this.scheduledExecutor.isTerminated()) { |
|
|
|
|
|
|
|
LogFactory.getLog(getClass()).debug("Ignoring scheduled task exception after shutdown", ex); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
TaskUtils.getDefaultErrorHandler(true).handleError(ex); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|