Skip to content

Commit

Permalink
Merge pull request #17096 from adrianfiedler/16942-docs-pause-id
Browse files Browse the repository at this point in the history
16942: Update scheduler-reference.adoc for pause/resume of single method
  • Loading branch information
mkouba authored May 11, 2021
2 parents 100ede5 + 85469af commit ed53b12
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/src/main/asciidoc/scheduler-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void nonConcurrent() {

== Scheduler

Quarkus provides a built-in bean of type `io.quarkus.scheduler.Scheduler` that can be injected and used to pause/resume the scheduler.
Quarkus provides a built-in bean of type `io.quarkus.scheduler.Scheduler` that can be injected and used to pause/resume the scheduler and individual scheduled methods identified by a specific `Scheduled#identity()`.

.Scheduler Injection Example
[source,java]
Expand All @@ -215,15 +215,19 @@ class MyService {
void ping() {
scheduler.pause(); <1>
scheduler.pause("myIdentity"); <2>
if (scheduler.isRunning()) {
throw new IllegalStateException("This should never happen!");
}
scheduler.resume(); <2>
scheduler.resume("myIdentity"); <3>
scheduler.resume(); <4>
}
}
----
<1> Pause all triggers.
<2> Resume the scheduler.
<2> Pause a specific scheduled method by its identity
<3> Resume a specific scheduled method by its identity
<4> Resume the scheduler.

== Programmatic Scheduling

Expand Down

0 comments on commit ed53b12

Please sign in to comment.