org.springframework.scheduling.support.DelegatingErrorHandlingRunnable Java Examples

The following examples show how to use org.springframework.scheduling.support.DelegatingErrorHandlingRunnable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DecoratedThreadPoolTaskExecutorTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
protected AsyncListenableTaskExecutor buildExecutor() {
	ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
	executor.setTaskDecorator(runnable ->
			new DelegatingErrorHandlingRunnable(runnable, TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER));
	executor.setThreadNamePrefix(THREAD_NAME_PREFIX);
	executor.setMaxPoolSize(1);
	executor.afterPropertiesSet();
	return executor;
}
 
Example #2
Source File: DecoratedThreadPoolTaskExecutorTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
protected AsyncListenableTaskExecutor buildExecutor() {
	ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
	executor.setTaskDecorator(runnable ->
			new DelegatingErrorHandlingRunnable(runnable, TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER));
	executor.setThreadNamePrefix(THREAD_NAME_PREFIX);
	executor.setMaxPoolSize(1);
	executor.afterPropertiesSet();
	return executor;
}
 
Example #3
Source File: ScheduledExecutorFactoryBean.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Determine the actual Runnable to schedule for the given task.
 * <p>Wraps the task's Runnable in a
 * {@link org.springframework.scheduling.support.DelegatingErrorHandlingRunnable}
 * that will catch and log the Exception. If necessary, it will suppress the
 * Exception according to the
 * {@link #setContinueScheduledExecutionAfterException "continueScheduledExecutionAfterException"}
 * flag.
 * @param task the ScheduledExecutorTask to schedule
 * @return the actual Runnable to schedule (may be a decorator)
 */
protected Runnable getRunnableToSchedule(ScheduledExecutorTask task) {
	return (this.continueScheduledExecutionAfterException ?
			new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_SUPPRESS_ERROR_HANDLER) :
			new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER));
}
 
Example #4
Source File: ScheduledExecutorFactoryBean.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Determine the actual Runnable to schedule for the given task.
 * <p>Wraps the task's Runnable in a
 * {@link org.springframework.scheduling.support.DelegatingErrorHandlingRunnable}
 * that will catch and log the Exception. If necessary, it will suppress the
 * Exception according to the
 * {@link #setContinueScheduledExecutionAfterException "continueScheduledExecutionAfterException"}
 * flag.
 * @param task the ScheduledExecutorTask to schedule
 * @return the actual Runnable to schedule (may be a decorator)
 */
protected Runnable getRunnableToSchedule(ScheduledExecutorTask task) {
	return (this.continueScheduledExecutionAfterException ?
			new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_SUPPRESS_ERROR_HANDLER) :
			new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER));
}
 
Example #5
Source File: ScheduledExecutorFactoryBean.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Determine the actual Runnable to schedule for the given task.
 * <p>Wraps the task's Runnable in a
 * {@link org.springframework.scheduling.support.DelegatingErrorHandlingRunnable}
 * that will catch and log the Exception. If necessary, it will suppress the
 * Exception according to the
 * {@link #setContinueScheduledExecutionAfterException "continueScheduledExecutionAfterException"}
 * flag.
 * @param task the ScheduledExecutorTask to schedule
 * @return the actual Runnable to schedule (may be a decorator)
 */
protected Runnable getRunnableToSchedule(ScheduledExecutorTask task) {
	return (this.continueScheduledExecutionAfterException ?
			new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_SUPPRESS_ERROR_HANDLER) :
			new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER));
}
 
Example #6
Source File: ScheduledExecutorFactoryBean.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Determine the actual Runnable to schedule for the given task.
 * <p>Wraps the task's Runnable in a
 * {@link org.springframework.scheduling.support.DelegatingErrorHandlingRunnable}
 * that will catch and log the Exception. If necessary, it will suppress the
 * Exception according to the
 * {@link #setContinueScheduledExecutionAfterException "continueScheduledExecutionAfterException"}
 * flag.
 * @param task the ScheduledExecutorTask to schedule
 * @return the actual Runnable to schedule (may be a decorator)
 */
protected Runnable getRunnableToSchedule(ScheduledExecutorTask task) {
	return (this.continueScheduledExecutionAfterException ?
			new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_SUPPRESS_ERROR_HANDLER) :
			new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER));
}