|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.scheduling.config.ScheduledTaskRegistrar
public class ScheduledTaskRegistrar
Helper bean for registering tasks with a TaskScheduler
,
typically using cron expressions.
As of Spring 3.1, ScheduledTaskRegistrar
has a more prominent user-facing
role when used in conjunction with the @EnableAsync
annotation and its
SchedulingConfigurer
callback interface.
EnableAsync
,
SchedulingConfigurer
Field Summary | |
---|---|
private java.util.Map<java.lang.Runnable,java.lang.String> |
cronTasks
|
private java.util.Map<java.lang.Runnable,java.lang.Long> |
fixedDelayTasks
|
private java.util.Map<java.lang.Runnable,java.lang.Long> |
fixedRateTasks
|
private java.util.concurrent.ScheduledExecutorService |
localExecutor
|
private java.util.Set<java.util.concurrent.ScheduledFuture<?>> |
scheduledFutures
|
private TaskScheduler |
taskScheduler
|
private java.util.Map<java.lang.Runnable,Trigger> |
triggerTasks
|
Constructor Summary | |
---|---|
ScheduledTaskRegistrar()
|
Method Summary | |
---|---|
void |
addCronTask(java.lang.Runnable task,
java.lang.String cronExpression)
Add a Runnable task to be triggered per the given cron expression |
void |
addFixedDelayTask(java.lang.Runnable task,
long delay)
Add a Runnable task to be triggered with the given fixed delay. |
void |
addFixedRateTask(java.lang.Runnable task,
long period)
Add a Runnable task to be triggered at the given fixed-rate period. |
void |
addTriggerTask(java.lang.Runnable task,
Trigger trigger)
Add a Runnable task to be triggered per the given Trigger . |
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware). |
void |
destroy()
Invoked by a BeanFactory on destruction of a singleton. |
TaskScheduler |
getScheduler()
Return the scheduler instance for this registrar (may be null) |
void |
setCronTasks(java.util.Map<java.lang.Runnable,java.lang.String> cronTasks)
Specify triggered tasks as a Map of Runnables (the tasks) and cron expressions. |
void |
setFixedDelayTasks(java.util.Map<java.lang.Runnable,java.lang.Long> fixedDelayTasks)
Specify triggered tasks as a Map of Runnables (the tasks) and fixed-delay values. |
void |
setFixedRateTasks(java.util.Map<java.lang.Runnable,java.lang.Long> fixedRateTasks)
Specify triggered tasks as a Map of Runnables (the tasks) and fixed-rate values. |
void |
setScheduler(java.lang.Object scheduler)
Set the TaskScheduler to register scheduled
tasks with, or a ScheduledExecutorService to be
wrapped as a TaskScheduler. |
void |
setTaskScheduler(TaskScheduler taskScheduler)
Set the TaskScheduler to register scheduled tasks with. |
void |
setTriggerTasks(java.util.Map<java.lang.Runnable,Trigger> triggerTasks)
Specify triggered tasks as a Map of Runnables (the tasks) and Trigger objects (typically custom implementations of the Trigger interface). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private TaskScheduler taskScheduler
private java.util.concurrent.ScheduledExecutorService localExecutor
private java.util.Map<java.lang.Runnable,Trigger> triggerTasks
private java.util.Map<java.lang.Runnable,java.lang.String> cronTasks
private java.util.Map<java.lang.Runnable,java.lang.Long> fixedRateTasks
private java.util.Map<java.lang.Runnable,java.lang.Long> fixedDelayTasks
private final java.util.Set<java.util.concurrent.ScheduledFuture<?>> scheduledFutures
Constructor Detail |
---|
public ScheduledTaskRegistrar()
Method Detail |
---|
public void setTaskScheduler(TaskScheduler taskScheduler)
public void setScheduler(java.lang.Object scheduler)
TaskScheduler
to register scheduled
tasks with, or a ScheduledExecutorService
to be
wrapped as a TaskScheduler.
public TaskScheduler getScheduler()
public void setTriggerTasks(java.util.Map<java.lang.Runnable,Trigger> triggerTasks)
Trigger
interface).
public void setCronTasks(java.util.Map<java.lang.Runnable,java.lang.String> cronTasks)
CronTrigger
public void setFixedRateTasks(java.util.Map<java.lang.Runnable,java.lang.Long> fixedRateTasks)
TaskScheduler.scheduleAtFixedRate(Runnable, long)
public void addTriggerTask(java.lang.Runnable task, Trigger trigger)
Trigger
.
TaskScheduler.scheduleAtFixedRate(Runnable, long)
public void addCronTask(java.lang.Runnable task, java.lang.String cronExpression)
public void addFixedDelayTask(java.lang.Runnable task, long delay)
TaskScheduler.scheduleWithFixedDelay(Runnable, long)
public void addFixedRateTask(java.lang.Runnable task, long period)
TaskScheduler.scheduleAtFixedRate(Runnable, long)
public void setFixedDelayTasks(java.util.Map<java.lang.Runnable,java.lang.Long> fixedDelayTasks)
TaskScheduler.scheduleWithFixedDelay(Runnable, long)
public void afterPropertiesSet()
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
public void destroy()
DisposableBean
destroy
in interface DisposableBean
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |