org.apache.ignite.scheduler

## Interface SchedulerFuture<R>

- All Superinterfaces:
    IgniteFuture<R>

      public interface SchedulerFuture<R>
      extends IgniteFuture<R>

  Future for cron-based scheduled execution. This future is returned when calling `IgniteScheduler.scheduleLocal(Callable, String)` or `IgniteScheduler.scheduleLocal(Runnable, String)` methods.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `averageExecutionTime()` Gets average execution time in milliseconds since future was created.
    `double` | `averageIdleTime()` Gets average idle time for this scheduled task.
    `int` | `count()` Gets total count of executions this task has already completed.
    `long` | `createTime()` Gets time in milliseconds at which this future was created.
    `R` | `get()` Waits for the completion of the next scheduled execution and returns its result.
    `R` | `get(long timeout, TimeUnit unit)` Waits for the completion of the next scheduled execution for specified amount of time and returns its result.
    `String` | `id()` Gets scheduled task ID.
    `boolean` | `isRunning()` Returns `true` if scheduled task is currently running.
    `R` | `last()` Gets result of the last execution of scheduled task, or `null` if task has not been executed, or has not produced a result yet.
    `long` | `lastFinishTime()` Gets finish time of last execution (`0` if first execution has not finished).
    `long` | `lastIdleTime()` Gets last interval between scheduled executions.
    `long` | `lastStartTime()` Gets start time of last execution (`0` if never started).
    `long` | `nextExecutionTime()` Gets next execution time of scheduled task.
    `long[]` | `nextExecutionTimes(int cnt, long start)` Gets an array of the next execution times after passed `start` timestamp.
    `String` | `pattern()` Gets scheduling pattern.

    - ### Methods inherited from interface org.apache.ignite.lang.IgniteFuture

      `cancel, chain, chainAsync, get, isCancelled, isDone, listen, listenAsync`

- - ### Method Detail

    - #### id

          String id()

      Gets scheduled task ID.
      Returns:
        ID of scheduled task.

    - #### pattern

          String pattern()

      Gets scheduling pattern.
      Returns:
        Scheduling pattern.

    - #### createTime

          long createTime()

      Gets time in milliseconds at which this future was created.
      Returns:
        Time in milliseconds at which this future was created.

    - #### lastStartTime

          long lastStartTime()

      Gets start time of last execution (`0` if never started).
      Returns:
        Start time of last execution.

    - #### lastFinishTime

          long lastFinishTime()

      Gets finish time of last execution (`0` if first execution has not finished).
      Returns:
        Finish time of last execution (`0` if first execution has not finished).

    - #### averageExecutionTime

          double averageExecutionTime()

      Gets average execution time in milliseconds since future was created.
      Returns:
        Average execution time in milliseconds since future was created.

    - #### lastIdleTime

          long lastIdleTime()

      Gets last interval between scheduled executions. If first execution has not yet happened, then returns time passed since creation of this future.
      Returns:
        Last interval between scheduled executions.

    - #### averageIdleTime

          double averageIdleTime()

      Gets average idle time for this scheduled task.
      Returns:
        Average idle time for this scheduled task.

    - #### nextExecutionTimes

          long[] nextExecutionTimes(int cnt,
                                    long start)
                             throws IgniteException

      Gets an array of the next execution times after passed `start` timestamp.
      Parameters:
        `cnt` - Array length.
        `start` - Start timestamp.
      Returns:
        Array of the next execution times in milliseconds or an empty array if there is no next execution time scheduled.
      Throws:
        `IgniteException` - Thrown in case of any errors.

    - #### count

          int count()

      Gets total count of executions this task has already completed.
      Returns:
        Total count of executions this task has already completed.

    - #### isRunning

          boolean isRunning()

      Returns `true` if scheduled task is currently running.
      Returns:
        `True` if scheduled task is currently running.

    - #### nextExecutionTime

          long nextExecutionTime()
                          throws IgniteException

      Gets next execution time of scheduled task.
      Returns:
        Next execution time in milliseconds or `0` if there is no next execution time.
      Throws:
        `IgniteException` - Thrown in case of any errors.

    - #### last

          R last()
          throws IgniteException

      Gets result of the last execution of scheduled task, or `null` if task has not been executed, or has not produced a result yet.
      Returns:
        Result of the last execution, or `null` if there isn't one yet.
      Throws:
        `IgniteException` - If last execution resulted in exception.

    - #### get

          R get()

      Waits for the completion of the next scheduled execution and returns its result.
      Specified by:
        `get` in interface `IgniteFuture<R>`
      Returns:
        Result of the next execution.
      Throws:
        `CancellationException`
        `IgniteInterruptedException` - Subclass of `IgniteException` thrown if the wait was interrupted.
        `IgniteException` - If computation failed.

    - #### get

          R get(long timeout,
                TimeUnit unit)

      Waits for the completion of the next scheduled execution for specified amount of time and returns its result.
      Specified by:
        `get` in interface `IgniteFuture<R>`
      Parameters:
        `timeout` - The maximum time to wait.
        `unit` - The time unit of the `timeout` argument.
      Returns:
        The computed result of the next execution.
      Throws:
        `CancellationException`
        `IgniteInterruptedException` - Subclass of `IgniteException` thrown if the wait was interrupted.
        `IgniteFutureTimeoutException` - Subclass of `IgniteException` thrown if the wait was timed out.
        `IgniteException` - If computation failed.

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.16.0
Release Date | : December 15 2023