org.apache.ignite

## Interface IgniteScheduler

All Known Implementing Classes:
  IgniteSchedulerImpl

    public interface IgniteScheduler

Provides functionality for scheduling jobs locally using UNIX cron-based syntax. Instance of `GridScheduler` is obtained from grid as follows:

     GridScheduler s = Ignition.ignite().scheduler();

Scheduler supports standard UNIX `cron` format with optional prefix of `{n1, n2}`, where `n1` is delay of scheduling in seconds and `n2` is the number of execution. Both parameters are optional. Here's an example of scheduling a closure that broadcasts a message to all nodes five times, once every minute, with initial delay of two seconds:

     Ignition.ignite().scheduler().scheduleLocal(
         GridSchedulerFuture<?> = Ignition.ignite().scheduler().scheduleLocal(new Callable<Object>() {
             @Override public Object call() throws IgniteCheckedException {
                 g.broadcast(new GridCallable() {...}).get();
             }
         }, "{2, 5} * * * * *" // 2 seconds delay with 5 executions only.
     );

### Method Summary

All Methods Instance Methods Abstract Methods
`<R> IgniteFuture<R>` `callLocal(Callable<R> c)` Executes given callable on internal system thread pool asynchronously.
`IgniteFuture<?>` `runLocal(Runnable r)` Executes given closure on internal system thread pool asynchronously.
`Closeable` `runLocal(Runnable r, long delay, TimeUnit timeUnit)` Executes given closure after the delay.
`<R> SchedulerFuture<R>` `scheduleLocal(Callable<R> c, String ptrn)` Schedules job for execution using local cron-based scheduling.
`SchedulerFuture<?>` `scheduleLocal(Runnable job, String ptrn)` Schedules job for execution using local cron-based scheduling.

### Method Detail

#### runLocal

    IgniteFuture<?> runLocal(@Nullable
                             Runnable r)

Executes given closure on internal system thread pool asynchronously.

Note that class `IgniteRunnable` implements `Runnable` and class `IgniteOutClosure` implements `Callable` interface.

Parameters:
  `r` - Runnable to execute. If `null` - this method is no-op.
Returns:
  Future for this execution.
See Also:
  `callLocal(Callable)`, `IgniteClosure`

#### runLocal

    Closeable runLocal(@Nullable
                       Runnable r,
                       long delay,
                       TimeUnit timeUnit)

Executes given closure after the delay.

Note that class `IgniteRunnable` implements `Runnable`

Parameters:
  `r` - Runnable to execute.
  `delay` - Initial delay.
  `timeUnit` - Time granularity.
Returns:
  java.io.Closeable which can be used to cancel execution.

#### callLocal

    <R> IgniteFuture<R> callLocal(@Nullable
                                  Callable<R> c)

Executes given callable on internal system thread pool asynchronously.

Note that class `IgniteRunnable` implements `Runnable` and class `IgniteOutClosure` implements `Callable` interface.

Type Parameters:
  `R` - Type of the return value for the closure.
Parameters:
  `c` - Callable to execute. If `null` - this method is no-op.
Returns:
  Future for this execution.
See Also:
  `runLocal(Runnable)`, `IgniteOutClosure`

#### scheduleLocal

    SchedulerFuture<?> scheduleLocal(Runnable job,
                                     String ptrn)

Schedules job for execution using local cron-based scheduling.

Parameters:
  `job` - Job to schedule to run as a background cron-based job. If `null` - this method is no-op.
  `ptrn` - Scheduling pattern in UNIX cron format with optional prefix `{n1, n2}` where `n1` is delay of scheduling in seconds and `n2` is the number of execution. Both parameters are optional.
Returns:
  Scheduled execution future.

#### scheduleLocal

    <R> SchedulerFuture<R> scheduleLocal(Callable<R> c,
                                         String ptrn)

Schedules job for execution using local cron-based scheduling.

Parameters:
  `c` - Job to schedule to run as a background cron-based job.
  `ptrn` - Scheduling pattern in UNIX cron format with optional prefix `{n1, n2}` where `n1` is delay of scheduling in seconds and `n2` is the number of execution. Both parameters are optional.
Returns:
  Scheduled execution future.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.4.0
Release Date | : March 5 2018