org.apache.ignite.compute

## Interface ComputeJobContinuation

- All Known Subinterfaces:
    ComputeJobContext
  All Known Implementing Classes:
    ComputeJobContinuationAdapter

      public interface ComputeJobContinuation

  Defines continuation support for grid job context.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `callcc()` Resumes job if it was held by `holdcc()` method.
    `boolean` | `heldcc()` Checks if job execution has been temporarily held (suspended).
    `<T> T` | `holdcc()` Holds (suspends) a given job indefinitely until `callcc()` is called.
    `<T> T` | `holdcc(long timeout)` Holds (suspends) a given job for specified timeout or until `callcc()` is called.

- - ### Method Detail

    - #### heldcc

          boolean heldcc()

      Checks if job execution has been temporarily held (suspended).

      If job has completed its execution, then `false` is always returned.

      Returns:
        `True` if job has been held.

    - #### holdcc

          @Nullable
          <T> T holdcc()

      Holds (suspends) a given job indefinitely until `callcc()` is called. Job will remain in active queue, but its `heldcc()` method will return `true`. Implementations of `CollisionSpi` should check if jobs are held or not as needed.

      All jobs should stop their execution and return right after calling `'holdcc(..)'` method. For convenience, this method always returns `null`, so you can hold and return in one line by calling `'return holdcc()'` method.

      If job is not running or has completed its execution, then no-op.

      The `'cc'` suffix stands for `'current-continuation'` which is a pretty standard notation for this concept that originated from Scheme programming language. Basically, the job is held to be continued later, hence the name of the method.

      Returns:
        Always returns `null` for convenience to be used in code with return statement.
      Throws:
        `IllegalStateException` - If job has been already held before.

    - #### holdcc

          @Nullable
          <T> T holdcc(long timeout)

      Holds (suspends) a given job for specified timeout or until `callcc()` is called. Holds (suspends) a given job for specified timeout or until `callcc()` is called. Job will remain in active queue, but its `heldcc()` method will return `true`. Implementations of `CollisionSpi` should check if jobs are held or not as needed.

      All jobs should stop their execution and return right after calling `'holdcc(..)'` method. For convenience, this method always returns `null`, so you can hold and return in one line by calling `'return holdcc()'`.

      If job is not running or has completed its execution, then no-op.

      The `'cc'` suffix stands for `'current-continuation'` which is a fairly standard notation for this concept. Basically, the job is held to be continued later, hence the name of the method.

      Parameters:
        `timeout` - Timeout in milliseconds after which job will be automatically resumed.
      Returns:
        Always returns `null` for convenience to be used in code with return statement.
      Throws:
        `IllegalStateException` - If job has been already held before

    - #### callcc

          void callcc()

      Resumes job if it was held by `holdcc()` method. Resuming job means that `ComputeJob.execute()` method will be called again. It is user's responsibility to check, as needed, whether job is executing from scratch and has been resumed.

      Note that the job is resumed with exactly the same state as of when it was 'held' via the `holdcc()` method.

      If job is not running, has not been suspended, or has completed its execution, then no-op.

      The method is named after `'call-with-current-continuation'` design pattern, commonly abbreviated as `'call/cc'`, which originated in Scheme programming language.

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.10.0
Release Date | : March 10 2021