Skip to content

Commit 0bfddbc

Browse files
committed
Polishing
1 parent 511dab1 commit 0bfddbc

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

framework-docs/src/docs/asciidoc/integration/scheduling.adoc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ implementations behind the common interfaces abstracts away the differences betw
99
SE 5, Java SE 6, and Jakarta EE environments.
1010

1111
Spring also features integration classes to support scheduling with the `Timer`
12-
(part of the JDK since 1.3) and the Quartz Scheduler ( https://www.quartz-scheduler.org/[]).
12+
(part of the JDK since 1.3) and the https://www.quartz-scheduler.org/[Quartz Scheduler].
1313
You can set up both of those schedulers by using a `FactoryBean` with optional references to
1414
`Timer` or `Trigger` instances, respectively. Furthermore, a convenience class for both
1515
the Quartz Scheduler and the `Timer` is available that lets you invoke a method of
@@ -171,7 +171,7 @@ much more flexible.
171171
The `Trigger` interface is essentially inspired by JSR-236 which, as of Spring 3.0,
172172
was not yet officially implemented. The basic idea of the `Trigger` is that execution
173173
times may be determined based on past execution outcomes or even arbitrary conditions.
174-
If these determinations do take into account the outcome of the preceding execution,
174+
If these determinations take into account the outcome of the preceding execution,
175175
that information is available within a `TriggerContext`. The `Trigger` interface itself
176176
is quite simple, as the following listing shows:
177177

@@ -208,7 +208,7 @@ Spring provides two implementations of the `Trigger` interface. The most interes
208208
is the `CronTrigger`. It enables the scheduling of tasks based on
209209
<<scheduling-cron-expression,cron expressions>>.
210210
For example, the following task is scheduled to run 15 minutes past each hour but only
211-
during the 9-to-5 "`business hours`" on weekdays:
211+
during the 9-to-5 "business hours" on weekdays:
212212

213213
[source,java,indent=0]
214214
[subs="verbatim"]
@@ -782,9 +782,9 @@ You can use these macros instead of the six-digit value, thus: `@Scheduled(cron
782782
== Using the Quartz Scheduler
783783

784784
Quartz uses `Trigger`, `Job`, and `JobDetail` objects to realize scheduling of all kinds
785-
of jobs. For the basic concepts behind Quartz, see
786-
https://www.quartz-scheduler.org/[]. For convenience purposes, Spring offers a couple of
787-
classes that simplify using Quartz within Spring-based applications.
785+
of jobs. For the basic concepts behind Quartz, see the
786+
https://www.quartz-scheduler.org/[Quartz Web site]. For convenience purposes, Spring
787+
offers a couple of classes that simplify using Quartz within Spring-based applications.
788788

789789

790790
[[scheduling-quartz-jobdetail]]
@@ -882,12 +882,13 @@ that merely invoke a method. You need only create the actual business object and
882882
wire up the detail object.
883883

884884
By default, Quartz Jobs are stateless, resulting in the possibility of jobs interfering
885-
with each other. If you specify two triggers for the same `JobDetail`, it is
886-
possible that, before the first job has finished, the second one starts. If
887-
`JobDetail` classes implement the `Stateful` interface, this does not happen. The second
888-
job does not start before the first one has finished. To make jobs resulting from the
889-
`MethodInvokingJobDetailFactoryBean` be non-concurrent, set the `concurrent` flag to
890-
`false`, as the following example shows:
885+
with each other. If you specify two triggers for the same `JobDetail`, it is possible
886+
that the second one starts before the first job has finished. If `JobDetail` classes
887+
implement the `Stateful` interface, this does not happen: the second job does not start
888+
before the first one has finished.
889+
890+
To make jobs resulting from the `MethodInvokingJobDetailFactoryBean` be non-concurrent,
891+
set the `concurrent` flag to `false`, as the following example shows:
891892

892893
[source,xml,indent=0,subs="verbatim,quotes"]
893894
----

spring-context/src/main/java/org/springframework/scheduling/Trigger.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public interface Trigger {
3434

3535
/**
3636
* Determine the next execution time according to the given trigger context.
37+
* <p>The default implementation delegates to {@link #nextExecution(TriggerContext)}.
3738
* @param triggerContext context object encapsulating last execution times
3839
* and last completion time
3940
* @return the next execution time as defined by the trigger,

spring-context/src/main/java/org/springframework/scheduling/TriggerContext.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public interface TriggerContext {
3333

3434
/**
3535
* Return the clock to use for trigger calculation.
36+
* <p>Defaults to {@link Clock#systemDefaultZone()}.
3637
* @since 5.3
3738
* @see TaskScheduler#getClock()
38-
* @see Clock#systemDefaultZone()
3939
*/
4040
default Clock getClock() {
4141
return Clock.systemDefaultZone();
@@ -44,6 +44,7 @@ default Clock getClock() {
4444
/**
4545
* Return the last <i>scheduled</i> execution time of the task,
4646
* or {@code null} if not scheduled before.
47+
* <p>The default implementation delegates to {@link #lastScheduledExecution()}.
4748
* @deprecated as of 6.0, in favor on {@link #lastScheduledExecution()}
4849
*/
4950
@Nullable
@@ -64,10 +65,11 @@ default Date lastScheduledExecutionTime() {
6465
/**
6566
* Return the last <i>actual</i> execution time of the task,
6667
* or {@code null} if not scheduled before.
68+
* <p>The default implementation delegates to {@link #lastActualExecution()}.
6769
* @deprecated as of 6.0, in favor on {@link #lastActualExecution()}
6870
*/
69-
@Deprecated(since = "6.0")
7071
@Nullable
72+
@Deprecated(since = "6.0")
7173
default Date lastActualExecutionTime() {
7274
Instant instant = lastActualExecution();
7375
return instant != null ? Date.from(instant) : null;
@@ -83,6 +85,7 @@ default Date lastActualExecutionTime() {
8385
/**
8486
* Return the last completion time of the task,
8587
* or {@code null} if not scheduled before.
88+
* <p>The default implementation delegates to {@link #lastCompletion()}.
8689
* @deprecated as of 6.0, in favor on {@link #lastCompletion()}
8790
*/
8891
@Deprecated(since = "6.0")

0 commit comments

Comments
 (0)