org.apache.ignite.spi

## Class ExponentialBackoffTimeoutStrategy

- java.lang.Object
- - org.apache.ignite.spi.ExponentialBackoffTimeoutStrategy

- All Implemented Interfaces:
    TimeoutStrategy

      public class ExponentialBackoffTimeoutStrategy
      extends Object
      implements TimeoutStrategy

  Strategy which incorporates retriable network operation, handling of totalTimeout logic. It increases startTimeout based on exponential backoff algorithm. If failure detection is enabled it relies on totalTimeout otherwise implements exponential backoff totalTimeout logic based on startTimeout, maxTimeout and retryCnt.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExponentialBackoffTimeoutStrategy(long totalTimeout, long startTimeout, long maxTimeout)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static long` | `backoffTimeout(long timeout, long maxTimeout)`
    `boolean` | `checkTimeout(long timeInFut)` Check if total timeout will be reached in now() + timeInFut.
    `long` | `nextTimeout(long timeout)` Get next timeout based on previously timeout calculated by strategy.
    `String` | `toString()`
    `static long` | `totalBackoffTimeout(long initTimeout, long maxTimeout, long reconCnt)` Compute expected max backoff timeout based on initTimeout, maxTimeout and reconCnt and backoff coefficient.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.ignite.spi.TimeoutStrategy

      `checkTimeout, nextTimeout`

- - ### Constructor Detail

    - #### ExponentialBackoffTimeoutStrategy

          public ExponentialBackoffTimeoutStrategy(long totalTimeout,
                                                   long startTimeout,
                                                   long maxTimeout)

      Parameters:
        `totalTimeout` - Total startTimeout.
        `startTimeout` - Initial connection timeout.
        `maxTimeout` - Max connection Timeout.

  - ### Method Detail

    - #### totalBackoffTimeout

          public static long totalBackoffTimeout(long initTimeout,
                                                 long maxTimeout,
                                                 long reconCnt)

      Compute expected max backoff timeout based on initTimeout, maxTimeout and reconCnt and backoff coefficient.
      Parameters:
        `initTimeout` - Initial timeout.
        `maxTimeout` - Max Timeout per retry.
        `reconCnt` - Reconnection count.
      Returns:
        Calculated total backoff timeout.

    - #### backoffTimeout

          public static long backoffTimeout(long timeout,
                                            long maxTimeout)

      Parameters:
        `timeout` - Timeout.
        `maxTimeout` - Maximum startTimeout for backoff function.
      Returns:
        Next exponential backoff timeout.

    - #### nextTimeout

          public long nextTimeout(long timeout)
                           throws IgniteSpiOperationTimeoutException

      Get next timeout based on previously timeout calculated by strategy.
      Specified by:
        `nextTimeout` in interface `TimeoutStrategy`
      Parameters:
        `timeout` - Current timeout value that is used to calculate the next one.
      Returns:
        Gets next timeout.
      Throws:
        `IgniteSpiOperationTimeoutException` - in case of total timeout already breached.

    - #### checkTimeout

          public boolean checkTimeout(long timeInFut)

      Check if total timeout will be reached in now() + timeInFut. If timeInFut is 0, will check that timeout already reached.
      Specified by:
        `checkTimeout` in interface `TimeoutStrategy`
      Parameters:
        `timeInFut` - Some millis in future.
      Returns:
        `True` if total timeout will be reached.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022