org.apache.ignite.spi

## Class IgniteSpiOperationTimeoutHelper

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

-     public class IgniteSpiOperationTimeoutHelper
      extends Object

  Object that incorporates logic that determines a timeout value for the next network related operation and checks whether a failure detection timeout is reached or not. A new instance of the class should be created for every complex network based operations that usually consists of request and response parts.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IgniteSpiOperationTimeoutHelper(IgniteSpiAdapter adapter, boolean srvOp)` Constructor.
    `IgniteSpiOperationTimeoutHelper(IgniteSpiAdapter adapter, boolean srvOp, long lastRelatedOperationTime, long absoluteThreshold)` Creates timeout helper based on time of last related operation.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `checkFailureTimeoutReached(Exception e)` Checks whether the given `Exception` is a timeout.
    `long` | `nextTimeoutChunk(long dfltTimeout)` Returns a timeout value to use for the next network operation.

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

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

- - ### Constructor Detail

    - #### IgniteSpiOperationTimeoutHelper

          public IgniteSpiOperationTimeoutHelper(IgniteSpiAdapter adapter,
                                                 boolean srvOp)

      Constructor.
      Parameters:
        `adapter` - SPI adapter.
        `srvOp` - `True` if communicates with server node.

    - #### IgniteSpiOperationTimeoutHelper

          public IgniteSpiOperationTimeoutHelper(IgniteSpiAdapter adapter,
                                                 boolean srvOp,
                                                 long lastRelatedOperationTime,
                                                 long absoluteThreshold)

      Creates timeout helper based on time of last related operation.
      Parameters:
        `adapter` - SPI adapter.
        `srvOp` - `True` if communicates with server node.
        `lastRelatedOperationTime` - Time of last related operation in nanos. Ignored if negative, 0 or `adapter.failureDetectionTimeoutEnabled()` is false.
        `absoluteThreshold` - Absolute time threshold (nanos) which must not be reached. Ignored if negative or 0.

  - ### Method Detail

    - #### nextTimeoutChunk

          public long nextTimeoutChunk(long dfltTimeout)
                                throws IgniteSpiOperationTimeoutException

      Returns a timeout value to use for the next network operation. If failure detection timeout is enabled then the returned value is a portion of time left since the last time this method is called. If the timeout is disabled then `dfltTimeout` is returned.
      Parameters:
        `dfltTimeout` - Timeout to use if failure detection timeout is disabled.
      Returns:
        Timeout in milliseconds.
      Throws:
        `IgniteSpiOperationTimeoutException` - If failure detection timeout is reached for an operation that uses this `IgniteSpiOperationTimeoutController`.

    - #### checkFailureTimeoutReached

          public boolean checkFailureTimeoutReached(Exception e)

      Checks whether the given `Exception` is a timeout.
      Parameters:
        `e` - Exception to check.
      Returns:
        `True` if given exception is a timeout. `False` otherwise.

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