From 85469af5fe79adfa0aa397f3608341d743a9e0d2 Mon Sep 17 00:00:00 2001 From: adrianfiedler Date: Sun, 9 May 2021 20:33:40 +0200 Subject: [PATCH] Update scheduler-reference.adoc fix #16942: Add example of pause/resume of specific identity --- docs/src/main/asciidoc/scheduler-reference.adoc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/src/main/asciidoc/scheduler-reference.adoc b/docs/src/main/asciidoc/scheduler-reference.adoc index b64ba1308585c..5c5310889fd17 100644 --- a/docs/src/main/asciidoc/scheduler-reference.adoc +++ b/docs/src/main/asciidoc/scheduler-reference.adoc @@ -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] @@ -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