org.apache.ignite.spi.failover.never

## Class NeverFailoverSpi

- java.lang.Object
- - org.apache.ignite.spi.IgniteSpiAdapter
  - - org.apache.ignite.spi.failover.never.NeverFailoverSpi

All Implemented Interfaces:
  FailoverSpi, IgniteSpi

    @IgniteSpiMultipleInstancesSupport(value=true)
    public class NeverFailoverSpi
    extends IgniteSpiAdapter
    implements FailoverSpi

This class provides failover SPI implementation that never fails over. This implementation never fails over a failed job by always returning `null` out of `FailoverSpi.failover(org.apache.ignite.spi.failover.FailoverContext, List)` method.

# Configuration

## Mandatory

This SPI has no mandatory configuration parameters.

## Optional

This SPI has no optional configuration parameters.

Here is a Java example on how to configure grid with `GridNeverFailoverSpi`:

     NeverFailoverSpi spi = new NeverFailoverSpi();

     IgniteConfiguration cfg = new IgniteConfiguration();

     // Override default failover SPI.
     cfg.setFailoverSpiSpi(spi);

     // Starts grid.
     G.start(cfg);

Here is an example on how to configure grid with `NeverFailoverSpi` from Spring XML configuration file:

     <property name="failoverSpi">
     <bean class="org.apache.ignite.spi.failover.never.NeverFailoverSpi"/>
     </property>

For information about Spring framework visit www.springframework.org

See Also:
  `FailoverSpi`

### Field Summary

### Fields inherited from class org.apache.ignite.spi.IgniteSpiAdapter

`ignite, igniteInstanceName`

### Constructor Summary

Constructors
Constructor and Description
`NeverFailoverSpi()`

### Method Summary

All Methods Instance Methods Concrete Methods
`ClusterNode` `failover(FailoverContext ctx, List<ClusterNode> top)` This method is called when method `ComputeTask.result(org.apache.ignite.compute.ComputeJobResult, List)` returns value `ComputeJobResultPolicy.FAILOVER` policy indicating that the result of job execution must be failed over.
`NeverFailoverSpi` `setName(String name)` Sets SPI name.
`void` `spiStart(String igniteInstanceName)` This method is called to start SPI.
`void` `spiStop()` This method is called to stop SPI.
`String` `toString()`

### Methods inherited from class org.apache.ignite.spi.IgniteSpiAdapter

`addTimeoutObject, assertParameter, checkConfigurationConsistency0, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, getConsistentAttributeNames, getExceptionRegistry, getLocalNode, getName, getNodeAttributes, getSpiContext, ignite, initFailureDetectionTimeout, injectables, injectResources, isNodeStopping, onBeforeStart, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextDestroyed0, onContextInitialized, onContextInitialized0, registerMBean, removeTimeoutObject, started, startInfo, startStopwatch, stopInfo, unregisterMBean`

### 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.IgniteSpi

`getName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized`

### Constructor Detail

#### NeverFailoverSpi

    public NeverFailoverSpi()

### Method Detail

#### spiStart

    public void spiStart(String igniteInstanceName)
                  throws IgniteSpiException

This method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.

Specified by:
  `spiStart` in interface `IgniteSpi`
Parameters:
  `igniteInstanceName` - Name of Ignite instance this SPI is being started for (`null` for default Ignite instance).
Throws:
  `IgniteSpiException` - Throws in case of any error during SPI start.

#### spiStop

    public void spiStop()
                 throws IgniteSpiException

This method is called to stop SPI. After this method returns kernel assumes that this SPI is finished and all resources acquired by it are released.

Note that this method can be called at any point including during recovery of failed start. It should make no assumptions on what state SPI will be in when this method is called.

Specified by:
  `spiStop` in interface `IgniteSpi`
Throws:
  `IgniteSpiException` - Thrown in case of any error during SPI stop.

#### failover

    public ClusterNode failover(FailoverContext ctx,
                                List<ClusterNode> top)

This method is called when method `ComputeTask.result(org.apache.ignite.compute.ComputeJobResult, List)` returns value `ComputeJobResultPolicy.FAILOVER` policy indicating that the result of job execution must be failed over. Implementation of this method should examine failover context and choose one of the grid nodes from supplied `topology` to retry job execution on it. For best performance it is advised that `FailoverContext.getBalancedNode(List)` method is used to select node for execution of failed job.

Specified by:
  `failover` in interface `FailoverSpi`
Parameters:
  `ctx` - Failover context.
  `top` - Collection of all grid nodes within task topology (may include failed node).
Returns:
  New node to route this job to or `null` if new node cannot be picked. If job failover fails (returns `null`) the whole task will be failed.

#### setName

    public NeverFailoverSpi setName(String name)

Sets SPI name.

Overrides:
  `setName` in class `IgniteSpiAdapter`
Parameters:
  `name` - SPI name.
Returns:
  `this` for chaining.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.16.0
Release Date | : December 15 2023