com.hazelcast.scheduledexecutor

## Interface IScheduledFuture<V>

- Type Parameters:
    `V` - The result type returned by this Future
  All Superinterfaces:
    Comparable<Delayed>, Delayed, Future<V>, ScheduledFuture<V>
  All Known Implementing Classes:
    ClientScheduledFutureProxy

      public interface IScheduledFuture<V>
      extends ScheduledFuture<V>

  A delayed result-bearing action that can be cancelled. Usually a scheduled future is the result of scheduling a task with a `IScheduledExecutorService`. Enhances the default `ScheduledFuture` API with support of statistics and time measurement info, through `ScheduledTaskStatistics`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `cancel(boolean mayInterruptIfRunning)` Attempts to cancel further scheduling of this task.
    `void` | `dispose()` Used to destroy the instance of the `IScheduledFuture` in the scheduled executor.
    `ScheduledTaskHandler` | `getHandler()` Returns the scheduled future resource handler.
    `ScheduledTaskStatistics` | `getStats()` Returns the statistics and time measurement info of the execution of this scheduled future in the `IScheduledExecutorService` it was scheduled.

    - ### Methods inherited from interface java.util.concurrent.Delayed

      `getDelay`

    - ### Methods inherited from interface java.lang.Comparable

      `compareTo`

    - ### Methods inherited from interface java.util.concurrent.Future

      `get, get, isCancelled, isDone`

- - ### Method Detail

    - #### getHandler

          ScheduledTaskHandler getHandler()

      Returns the scheduled future resource handler. Can be used to re-acquire control of the `IScheduledFuture` using the `IScheduledExecutorService.getScheduledFuture(ScheduledTaskHandler)`
      Returns:
        An instance of `ScheduledTaskHandler`, a resource handler for this scheduled future.

    - #### getStats

          ScheduledTaskStatistics getStats()

      Returns the statistics and time measurement info of the execution of this scheduled future in the `IScheduledExecutorService` it was scheduled.
      Returns:
        An instance of `ScheduledTaskStatistics`, holding all stas and measurements

    - #### dispose

          void dispose()

      Used to destroy the instance of the `IScheduledFuture` in the scheduled executor. Once the instance is destroyed, any subsequent action on the `IScheduledFuture` will fail with an `IllegalStateException` Attempting to re-create the `IScheduledFuture` from the `IScheduledExecutorService.getScheduledFuture(ScheduledTaskHandler)` using the `getHandler()` will succeed, but any subsequent access on that new future, will also fail with `StaleTaskException`

    - #### cancel

          boolean cancel(boolean mayInterruptIfRunning)

      Attempts to cancel further scheduling of this task. This attempt will fail if the task has already completed, has already been cancelled, or could not be cancelled for some other reason. If successful, and this task has not started when `cancel` is called, this task should never run.

      Warning: This cancel will not attempt to interrupt the running thread if the task is already in progress, will just cancel further scheduling.

      After this method returns, subsequent calls to `Future.isDone()` will always return `true`. Subsequent calls to `Future.isCancelled()` will always return `true` if this method returned `true`.

      Specified by:
        `cancel` in interface `Future<V>`
      Parameters:
        `mayInterruptIfRunning` - is throwing `UnsupportedOperationException`
      Returns:
        `false` if the task could not be cancelled, typically because it has already completed normally; {@code true

Copyright © 2020. All rights reserved.