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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0a8f535  IGNITE-13715 Fixed invalid cron expression in 
ComputeScheduleExample. Fixes #8470
0a8f535 is described below

commit 0a8f535f3f457854e5c9624ba4b6d6df2b29799f
Author: Slava Koptilin <[email protected]>
AuthorDate: Mon Nov 23 10:46:50 2020 +0300

    IGNITE-13715 Fixed invalid cron expression in ComputeScheduleExample. Fixes 
#8470
---
 .../examples/misc/schedule/ComputeScheduleExample.java       | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/examples/src/main/java-lgpl/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java
 
b/examples/src/main/java-lgpl/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java
index d480309..c58de3b 100644
--- 
a/examples/src/main/java-lgpl/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java
+++ 
b/examples/src/main/java-lgpl/org/apache/ignite/examples/misc/schedule/ComputeScheduleExample.java
@@ -29,6 +29,9 @@ import org.apache.ignite.scheduler.SchedulerFuture;
  * Demonstrates a cron-based {@link Runnable} execution scheduling.
  * Test runnable object broadcasts a phrase to all cluster nodes every minute
  * three times with initial scheduling delay equal to five seconds.
+ * This example uses an Ignite extension to Cron syntax,
+ * which can be used to specify an initial delay in seconds and a number of 
runs.
+ * https://apacheignite.readme.io/docs/cron-based-scheduling#syntax-extension
  * <p>
  * Remote nodes should always be started with special configuration file which
  * enables P2P class loading: {@code 'ignite.{sh|bat} 
examples/config/example-ignite.xml'}.
@@ -68,12 +71,19 @@ public class ComputeScheduleExample {
                         return invocations;
                     }
                 },
-                "{9, 5, 3} * * * * *" // Cron expression.
+                // Callable object broadcasts a phrase to all cluster nodes 
every minute
+                // three times with initial scheduling delay equal to five 
seconds.
+                // 
https://apacheignite.readme.io/docs/cron-based-scheduling#syntax-extension
+                "{5, 3} * * * * *" // Cron expression.
             );
 
             while (!fut.isDone())
                 System.out.println(">>> Invocation #: " + fut.get());
 
+            // In case the Cron expression is invalid, SchedulerFuture will be 
immediately completed with an error,
+            // that provides additional details.
+            fut.get();
+
             System.out.println();
             System.out.println(">>> Schedule future is done and has been 
unscheduled.");
             System.out.println(">>> Check all nodes for hello message 
output.");

Reply via email to