|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2012 the original author or authors. |
|
|
|
* Copyright 2002-2013 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. |
|
|
|
@ -37,9 +37,10 @@ import org.springframework.util.ObjectUtils; |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>Allows for registration of {@link ScheduledExecutorTask ScheduledExecutorTasks}, |
|
|
|
* <p>Allows for registration of {@link ScheduledExecutorTask ScheduledExecutorTasks}, |
|
|
|
* automatically starting the {@link ScheduledExecutorService} on initialization and |
|
|
|
* automatically starting the {@link ScheduledExecutorService} on initialization and |
|
|
|
* cancelling it on destruction of the context. In scenarios that just require static |
|
|
|
* cancelling it on destruction of the context. In scenarios that only require static |
|
|
|
* registration of tasks at startup, there is no need to access the |
|
|
|
* registration of tasks at startup, there is no need to access the |
|
|
|
* {@link ScheduledExecutorService} instance itself in application code. |
|
|
|
* {@link ScheduledExecutorService} instance itself in application code at all; |
|
|
|
|
|
|
|
* ScheduledExecutorFactoryBean is then just being used for lifecycle integration. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>Note that {@link java.util.concurrent.ScheduledExecutorService} |
|
|
|
* <p>Note that {@link java.util.concurrent.ScheduledExecutorService} |
|
|
|
* uses a {@link Runnable} instance that is shared between repeated executions, |
|
|
|
* uses a {@link Runnable} instance that is shared between repeated executions, |
|
|
|
@ -92,7 +93,7 @@ public class ScheduledExecutorFactoryBean extends ExecutorConfigurationSupport |
|
|
|
* @see java.util.concurrent.ScheduledExecutorService#scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) |
|
|
|
* @see java.util.concurrent.ScheduledExecutorService#scheduleWithFixedDelay(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) |
|
|
|
* @see java.util.concurrent.ScheduledExecutorService#scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) |
|
|
|
* @see java.util.concurrent.ScheduledExecutorService#scheduleAtFixedRate(java.lang.Runnable, long, long, java.util.concurrent.TimeUnit) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setScheduledExecutorTasks(ScheduledExecutorTask[] scheduledExecutorTasks) { |
|
|
|
public void setScheduledExecutorTasks(ScheduledExecutorTask... scheduledExecutorTasks) { |
|
|
|
this.scheduledExecutorTasks = scheduledExecutorTasks; |
|
|
|
this.scheduledExecutorTasks = scheduledExecutorTasks; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -193,9 +194,9 @@ public class ScheduledExecutorFactoryBean extends ExecutorConfigurationSupport |
|
|
|
* @return the actual Runnable to schedule (may be a decorator) |
|
|
|
* @return the actual Runnable to schedule (may be a decorator) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected Runnable getRunnableToSchedule(ScheduledExecutorTask task) { |
|
|
|
protected Runnable getRunnableToSchedule(ScheduledExecutorTask task) { |
|
|
|
return this.continueScheduledExecutionAfterException |
|
|
|
return (this.continueScheduledExecutionAfterException ? |
|
|
|
? new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_SUPPRESS_ERROR_HANDLER) |
|
|
|
new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_SUPPRESS_ERROR_HANDLER) : |
|
|
|
: new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER); |
|
|
|
new DelegatingErrorHandlingRunnable(task.getRunnable(), TaskUtils.LOG_AND_PROPAGATE_ERROR_HANDLER)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|