org.apache.ignite.internal.managers.failover

## Class GridFailoverContextImpl

- java.lang.Object
- - org.apache.ignite.internal.managers.failover.GridFailoverContextImpl

All Implemented Interfaces:
  FailoverContext

    public class GridFailoverContextImpl
    extends Object
    implements FailoverContext

GridFailoverContext implementation.

### Constructor Summary

Constructors
Constructor and Description
`GridFailoverContextImpl(GridTaskSessionImpl taskSes, ComputeJobResult jobRes, GridLoadBalancerManager loadMgr, int partId, String affCacheName, AffinityTopologyVersion topVer)` Initializes failover context.

### Method Summary

All Methods Instance Methods Concrete Methods
`String` `affinityCacheName()` Returns affinity cache name `IgniteCompute.affinityRun(String, Object, IgniteRunnable)` and `IgniteCompute.affinityCall(String, Object, IgniteCallable)`.
`AffinityTopologyVersion` `affinityTopologyVersion()`
`ClusterNode` `getBalancedNode(List<ClusterNode> top)` Gets the next balanced node for failed job.
`ComputeJobResult` `getJobResult()` Gets failed result of job execution.
`ComputeTaskSession` `getTaskSession()` Gets current task session.
`int` `partition()` Gets partition for `IgniteCompute.affinityRun(Collection, int, IgniteRunnable)` and `IgniteCompute.affinityCall(Collection, int, IgniteCallable)`.
`String` `toString()`

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

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

### Constructor Detail

#### GridFailoverContextImpl

    public GridFailoverContextImpl(GridTaskSessionImpl taskSes,
                                   ComputeJobResult jobRes,
                                   GridLoadBalancerManager loadMgr,
                                   int partId,
                                   @Nullable
                                   String affCacheName,
                                   @Nullable
                                   AffinityTopologyVersion topVer)

Initializes failover context.

Parameters:
  `taskSes` - Grid task session.
  `jobRes` - Failed job result.
  `loadMgr` - Load manager.
  `partId` - Partition.
  `affCacheName` - Affinity cache name.
  `topVer` - Affinity topology version.

### Method Detail

#### getTaskSession

    public ComputeTaskSession getTaskSession()

Gets current task session.

Specified by:
  `getTaskSession` in interface `FailoverContext`
Returns:
  Grid task session.

#### getJobResult

    public ComputeJobResult getJobResult()

Gets failed result of job execution.

Specified by:
  `getJobResult` in interface `FailoverContext`
Returns:
  Result of a failed job.

#### getBalancedNode

    public ClusterNode getBalancedNode(List<ClusterNode> top)

Gets the next balanced node for failed job. Internally this method will delegate to load balancing SPI (see `LoadBalancingSpi` to determine the optimal node for execution.

Specified by:
  `getBalancedNode` in interface `FailoverContext`
Parameters:
  `top` - Topology to pick balanced node from.
Returns:
  The next balanced node.

#### affinityCacheName

    @Nullable
    public String affinityCacheName()

Returns affinity cache name `IgniteCompute.affinityRun(String, Object, IgniteRunnable)` and `IgniteCompute.affinityCall(String, Object, IgniteCallable)`.

Specified by:
  `affinityCacheName` in interface `FailoverContext`
Returns:
  Cache name.

#### partition

    public int partition()

Gets partition for `IgniteCompute.affinityRun(Collection, int, IgniteRunnable)` and `IgniteCompute.affinityCall(Collection, int, IgniteCallable)`.

Specified by:
  `partition` in interface `FailoverContext`
Returns:
  Partition number.

#### affinityTopologyVersion

    @Nullable
    public AffinityTopologyVersion affinityTopologyVersion()

Returns:
  Affinity topology version.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.0
Release Date | : November 30 2018