diff --git a/spring-framework-reference/src/scheduling.xml b/spring-framework-reference/src/scheduling.xml
index ecf7346ef7a..3babddcadfc 100644
--- a/spring-framework-reference/src/scheduling.xml
+++ b/spring-framework-reference/src/scheduling.xml
@@ -19,252 +19,6 @@
away differences between Java SE 1.4, Java SE 5 and Java EE environments.
-
- Using the OpenSymphony Quartz Scheduler
- Quartz uses Trigger, Job and
- JobDetail objects to realize scheduling of all kinds of jobs.
- For the basic concepts behind Quartz, have a look at
- . For convenience purposes,
- Spring offers a couple of classes that simplify the usage of Quartz within
- Spring-based applications.
-
-
- Using the JobDetailBean
-
- JobDetail objects contain all information needed to
- run a job. The Spring Framework provides a JobDetailBean
- that makes the JobDetail more of an actual JavaBean
- with sensible defaults. Let's have a look at an example:
-
-
-
-
-
-
-]]>
- The job detail bean has all information it needs to run the job (ExampleJob).
- The timeout is specified in the job data map. The job data map is
- available through the JobExecutionContext
- (passed to you at execution time), but the JobDetailBean
- also maps the properties from the job data map to properties of the actual job.
- So in this case, if the ExampleJob contains a property
- named timeout, the JobDetailBean will
- automatically apply it:
- // do the actual work
- All additional settings from the job detail bean are of course available to you as well.
- Note: Using the name and group properties,
- you can modify the name and the group of the job, respectively. By default, the name of
- the job matches the bean name of the job detail bean (in the example above, this is
- exampleJob).
-
-
- Using the MethodInvokingJobDetailFactoryBean
- Often you just need to invoke a method on a specific object. Using the
- MethodInvokingJobDetailFactoryBean you can do exactly this:
-
-
-
-]]>
- The above example will result in the doIt method being called on the
- exampleBusinessObject method (see below):
- // properties and collaborators// do the actual work
-
- ]]>
- Using the MethodInvokingJobDetailFactoryBean, you don't need to
- create one-line jobs that just invoke a method, and you only need to create the actual
- business object and wire up the detail object.
- By default, Quartz Jobs are stateless, resulting in the possibility of jobs interfering
- with each other. If you specify two triggers for the same JobDetail,
- it might be possible that before the first job has finished, the second one will start.
- If JobDetail classes implement the
- Stateful interface, this won't happen. The second job
- will not start before the first one has finished. To make jobs resulting from the
- MethodInvokingJobDetailFactoryBean non-concurrent, set the
- concurrent flag to false.
-
-
-
-
-]]>
-
- By default, jobs will run in a concurrent fashion.
-
-
-
- Wiring up jobs using triggers and the SchedulerFactoryBean
-
- We've created job details and jobs. We've also reviewed the convenience bean
- that allows to you invoke a method on a specific object. Of course, we still need
- to schedule the jobs themselves. This is done using triggers and a
- SchedulerFactoryBean. Several triggers are available
- within Quartz. Spring offers two subclassed triggers with convenient defaults:
- CronTriggerBean and SimpleTriggerBean.
-
-
- Triggers need to be scheduled. Spring offers a SchedulerFactoryBean
- that exposes triggers to be set as properties. SchedulerFactoryBean
- schedules the actual jobs with those triggers.
-
- Find below a couple of examples:
-
-
-
-
-
-
-
-
-
-
-
-
-
-]]>
- Now we've set up two triggers, one running every 50 seconds with a starting delay of
- 10 seconds and one every morning at 6 AM. To finalize everything, we need to set up the
- SchedulerFactoryBean:
-
-
-
-
-
-
-
-]]>
-
- More properties are available for the SchedulerFactoryBean for you
- to set, such as the calendars used by the job details, properties to customize Quartz with,
- etc. Have a look at the
- SchedulerFactoryBean Javadoc
- for more information.
-
-
-
-
- Using JDK Timer support
-
- The other way to schedule jobs in Spring is to use JDK
- Timer objects. You can create custom timers or
- use the timer that invokes methods. Wiring timers is done using the
- TimerFactoryBean.
-
-
- Creating custom timers
-
- Using the TimerTask you can create customer
- timer tasks, similar to Quartz jobs:
-
- // iterate over all email addresses and archive them
-
- Wiring it up is simple:
-
-
-
-
- test@springframework.org
- foo@bar.com
- john@doe.net
-
-
-
-
-
- ]]><!-- wait 10 seconds before starting repeated execution -->
- ]]><!-- run every 50 seconds -->
-
-]]>
-
-
- Note that letting the task only run once can be done by changing the
- period property to 0 (or a negative value).
-
-
-
-
- Using the MethodInvokingTimerTaskFactoryBean
-
- Similar to the Quartz support, the Timer support also features
- a component that allows you to periodically invoke a method:
-
-
-
-
-]]>
-
- The above example will result in the doIt method being called on the
- exampleBusinessObject (see below):
-
- // properties and collaborators// do the actual work
- Changing the timerTask reference of the
- ScheduledTimerTask example to the bean doIt
- will result in the doIt method being executed on a fixed schedule.
-
-
- Wrapping up: setting up the tasks using the TimerFactoryBean
- The TimerFactoryBean is similar to the Quartz
- SchedulerFactoryBean in that it serves the same
- purpose: setting up the actual scheduling. The TimerFactoryBean
- sets up an actual Timer and schedules the tasks it has
- references to. You can specify whether or not daemon threads should be used.
-
-
-
- ]]><!-- see the example above -->
-
-
-]]>
-
-
The Spring TaskExecutor abstraction
@@ -622,5 +376,251 @@ public class TaskExecutorExample {
as scheduled, and potentially recurring, executions.
+
+ Using the OpenSymphony Quartz Scheduler
+ Quartz uses Trigger, Job and
+ JobDetail objects to realize scheduling of all kinds of jobs.
+ For the basic concepts behind Quartz, have a look at
+ . For convenience purposes,
+ Spring offers a couple of classes that simplify the usage of Quartz within
+ Spring-based applications.
+
+
+ Using the JobDetailBean
+
+ JobDetail objects contain all information needed to
+ run a job. The Spring Framework provides a JobDetailBean
+ that makes the JobDetail more of an actual JavaBean
+ with sensible defaults. Let's have a look at an example:
+
+
+
+
+
+
+]]>
+ The job detail bean has all information it needs to run the job (ExampleJob).
+ The timeout is specified in the job data map. The job data map is
+ available through the JobExecutionContext
+ (passed to you at execution time), but the JobDetailBean
+ also maps the properties from the job data map to properties of the actual job.
+ So in this case, if the ExampleJob contains a property
+ named timeout, the JobDetailBean will
+ automatically apply it:
+ // do the actual work
+ All additional settings from the job detail bean are of course available to you as well.
+ Note: Using the name and group properties,
+ you can modify the name and the group of the job, respectively. By default, the name of
+ the job matches the bean name of the job detail bean (in the example above, this is
+ exampleJob).
+
+
+ Using the MethodInvokingJobDetailFactoryBean
+ Often you just need to invoke a method on a specific object. Using the
+ MethodInvokingJobDetailFactoryBean you can do exactly this:
+
+
+
+]]>
+ The above example will result in the doIt method being called on the
+ exampleBusinessObject method (see below):
+ // properties and collaborators// do the actual work
+
+ ]]>
+ Using the MethodInvokingJobDetailFactoryBean, you don't need to
+ create one-line jobs that just invoke a method, and you only need to create the actual
+ business object and wire up the detail object.
+ By default, Quartz Jobs are stateless, resulting in the possibility of jobs interfering
+ with each other. If you specify two triggers for the same JobDetail,
+ it might be possible that before the first job has finished, the second one will start.
+ If JobDetail classes implement the
+ Stateful interface, this won't happen. The second job
+ will not start before the first one has finished. To make jobs resulting from the
+ MethodInvokingJobDetailFactoryBean non-concurrent, set the
+ concurrent flag to false.
+
+
+
+
+]]>
+
+ By default, jobs will run in a concurrent fashion.
+
+
+
+ Wiring up jobs using triggers and the SchedulerFactoryBean
+
+ We've created job details and jobs. We've also reviewed the convenience bean
+ that allows to you invoke a method on a specific object. Of course, we still need
+ to schedule the jobs themselves. This is done using triggers and a
+ SchedulerFactoryBean. Several triggers are available
+ within Quartz. Spring offers two subclassed triggers with convenient defaults:
+ CronTriggerBean and SimpleTriggerBean.
+
+
+ Triggers need to be scheduled. Spring offers a SchedulerFactoryBean
+ that exposes triggers to be set as properties. SchedulerFactoryBean
+ schedules the actual jobs with those triggers.
+
+ Find below a couple of examples:
+
+
+
+
+
+
+
+
+
+
+
+
+
+]]>
+ Now we've set up two triggers, one running every 50 seconds with a starting delay of
+ 10 seconds and one every morning at 6 AM. To finalize everything, we need to set up the
+ SchedulerFactoryBean:
+
+
+
+
+
+
+
+]]>
+
+ More properties are available for the SchedulerFactoryBean for you
+ to set, such as the calendars used by the job details, properties to customize Quartz with,
+ etc. Have a look at the
+ SchedulerFactoryBean Javadoc
+ for more information.
+
+
+
+
+ Using JDK Timer support
+
+ The other way to schedule jobs in Spring is to use JDK
+ Timer objects. You can create custom timers or
+ use the timer that invokes methods. Wiring timers is done using the
+ TimerFactoryBean.
+
+
+ Creating custom timers
+
+ Using the TimerTask you can create customer
+ timer tasks, similar to Quartz jobs:
+
+ // iterate over all email addresses and archive them
+
+ Wiring it up is simple:
+
+
+
+
+ test@springframework.org
+ foo@bar.com
+ john@doe.net
+
+
+
+
+
+ ]]><!-- wait 10 seconds before starting repeated execution -->
+ ]]><!-- run every 50 seconds -->
+
+]]>
+
+
+ Note that letting the task only run once can be done by changing the
+ period property to 0 (or a negative value).
+
+
+
+
+ Using the MethodInvokingTimerTaskFactoryBean
+
+ Similar to the Quartz support, the Timer support also features
+ a component that allows you to periodically invoke a method:
+
+
+
+
+]]>
+
+ The above example will result in the doIt method being called on the
+ exampleBusinessObject (see below):
+
+ // properties and collaborators// do the actual work
+ Changing the timerTask reference of the
+ ScheduledTimerTask example to the bean doIt
+ will result in the doIt method being executed on a fixed schedule.
+
+
+ Wrapping up: setting up the tasks using the TimerFactoryBean
+ The TimerFactoryBean is similar to the Quartz
+ SchedulerFactoryBean in that it serves the same
+ purpose: setting up the actual scheduling. The TimerFactoryBean
+ sets up an actual Timer and schedules the tasks it has
+ references to. You can specify whether or not daemon threads should be used.
+
+
+
+ ]]><!-- see the example above -->
+
+
+]]>
+
+
\ No newline at end of file