类 TaskUtils
java.lang.Object
cn.taketoday.scheduling.support.TaskUtils
Utility methods for decorating tasks with error handling.
NOTE: This class is intended for internal use by scheduler implementations. It is only public so that it may be accessed from impl classes within other packages. It is not intended for general use.
- 从以下版本开始:
- 4.0
- 作者:
- Mark Fisher, Juergen Hoeller
-
字段概要
字段修饰符和类型字段说明static final cn.taketoday.util.ErrorHandlerAn ErrorHandler strategy that will log at error level and then re-throw the Exception.static final cn.taketoday.util.ErrorHandlerAn ErrorHandler strategy that will log the Exception but perform no further handling. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明decorateTaskWithErrorHandler(Runnable task, cn.taketoday.util.ErrorHandler errorHandler, boolean isRepeatingTask) Decorate the task for error handling.static cn.taketoday.util.ErrorHandlergetDefaultErrorHandler(boolean isRepeatingTask) Return the defaultErrorHandlerimplementation based on the boolean value indicating whether the task will be repeating or not.
-
字段详细资料
-
LOG_AND_SUPPRESS_ERROR_HANDLER
public static final cn.taketoday.util.ErrorHandler LOG_AND_SUPPRESS_ERROR_HANDLERAn ErrorHandler strategy that will log the Exception but perform no further handling. This will suppress the error so that subsequent executions of the task will not be prevented. -
LOG_AND_PROPAGATE_ERROR_HANDLER
public static final cn.taketoday.util.ErrorHandler LOG_AND_PROPAGATE_ERROR_HANDLERAn ErrorHandler strategy that will log at error level and then re-throw the Exception. Note: this will typically prevent subsequent execution of a scheduled task.
-
-
构造器详细资料
-
TaskUtils
public TaskUtils()
-
-
方法详细资料
-
decorateTaskWithErrorHandler
public static DelegatingErrorHandlingRunnable decorateTaskWithErrorHandler(Runnable task, @Nullable cn.taketoday.util.ErrorHandler errorHandler, boolean isRepeatingTask) Decorate the task for error handling. If the providedErrorHandleris notnull, 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 returnedFuture. In both cases, the errors will be logged. -
getDefaultErrorHandler
public static cn.taketoday.util.ErrorHandler getDefaultErrorHandler(boolean isRepeatingTask) Return the defaultErrorHandlerimplementation based on the boolean value indicating whether the task will be repeating or not. For repeating tasks it will suppress errors, but for one-time tasks it will propagate. In both cases, the error will be logged.
-