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.

### Method Summary

Methods
`boolean` `checkFailureTimeoutReached(Exception e)` Checks whether the given `Exception` is generated because failure detection timeout has been reached.
`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.

### 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 generated because failure detection timeout has been reached.

Parameters:
  `e` - Exception.
Returns:
  `true` if failure detection timeout is reached, `false` otherwise.

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.1.0
Release Date | : July 20 2017