List of usage examples for org.springframework.scheduling.support DelegatingErrorHandlingRunnable DelegatingErrorHandlingRunnable
public DelegatingErrorHandlingRunnable(Runnable delegate, ErrorHandler errorHandler)
From source file:org.springframework.scheduling.support.TaskUtils.java
/** * Decorate the task for error handling. If the provided {@link ErrorHandler} * is not {@code null}, it will be used. Otherwise, repeating tasks will have * errors suppressed by default whereas one-shot tasks will have errors * propagated by default since those errors may be expected through the * returned {@link Future}. In both cases, the errors will be logged. *///from w w w . j a va2 s.c o m public static DelegatingErrorHandlingRunnable decorateTaskWithErrorHandler(Runnable task, @Nullable ErrorHandler errorHandler, boolean isRepeatingTask) { if (task instanceof DelegatingErrorHandlingRunnable) { return (DelegatingErrorHandlingRunnable) task; } ErrorHandler eh = (errorHandler != null ? errorHandler : getDefaultErrorHandler(isRepeatingTask)); return new DelegatingErrorHandlingRunnable(task, eh); }