This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new 4bb3dc2  [KARAF-3674] Improve Karaf scheduler documentation
4bb3dc2 is described below

commit 4bb3dc2230a2b15a6494d8dd00776f3d5ddac43d
Author: Jean-Baptiste Onofré <[email protected]>
AuthorDate: Wed Nov 22 15:49:36 2017 +0100

    [KARAF-3674] Improve Karaf scheduler documentation
---
 manual/src/main/asciidoc/user-guide/scheduler.adoc | 36 ++++++++++++++++++----
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/manual/src/main/asciidoc/user-guide/scheduler.adoc 
b/manual/src/main/asciidoc/user-guide/scheduler.adoc
index 835d1fe..24bb318 100644
--- a/manual/src/main/asciidoc/user-guide/scheduler.adoc
+++ b/manual/src/main/asciidoc/user-guide/scheduler.adoc
@@ -68,7 +68,7 @@ This example uses Declarative Services to register a Service 
of Type "org.apache
 
 Alternatively, jobs can be registered as type "Runnable" in a more API neutral 
way. In this case you won't get the "JobContext" information though.
 ----
-@Component (immediate = true, property = {
+@Component(immediate = true, property = {
         Scheduler.PROPERTY_SCHEDULER_EXPRESSION + "=0 0/10 * * * ?",
 } )
 public class SchedulerPing implements Job {
@@ -89,9 +89,38 @@ Name                   │ Schedule
 Registered Service.185 │ cron(0 0/10 * * * ?)
 ----
 
+The Karaf scheduler can also schedule `Runnable` service.
 
+For instance, if you have the following bean:
+
+```
+@Component(immediate = true, property = {
+    "scheduler.period:Long=60",
+    "scheduler.concurrent:Boolean=false",
+    "scheduler.name=PingJob"
+  }
+)
+public class PingThread implements Runnable {
+
+  @Override
+  public void run() {
+    // ..
+  }
+
+}
+```
+
+This will register a job for the thread (runnable):
+
+----
+karaf@root()> scheduler:list
+Name                       │ Schedule
+───────────────────────────┼──────────────────────────────────────────
+PingJob.126                │ at(2017-11-22T15:37:17.103+01:00, -1, 10)
+----
 
 ==== Schedule a new Job using the Gogo Shell
+
 ----
 karaf@root()> scheduler:schedule --help
 DESCRIPTION
@@ -125,11 +154,6 @@ OPTIONS
 
 ----
 
-For example:
-----
-tbd
-----
-
 ==== Schedule a new Job using the Scheduler Service
 
 Recommendation: Before using this low level api for registering jobs, consider 
using the whitebox approach instead.

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to