GridGain™ 3.6.0e
Enterprise Edition

org.gridgain.grid.spi.failover
Interface GridFailoverSpi

All Superinterfaces:
GridSpi, GridSpiJsonConfigurable
All Known Implementing Classes:
GridAlwaysFailoverSpi, GridJobStealingFailoverSpi, GridNeverFailoverSpi

public interface GridFailoverSpi
extends GridSpi, GridSpiJsonConfigurable

Failover SPI provides developer with ability to supply custom logic for handling failed execution of a grid job. Job execution can fail for a number of reasons:

In all cases failover SPI takes failed job (as failover context) and list of all grid nodes and provides another node on which the job execution will be retried. It is up to failover SPI to make sure that job is not mapped to the node it failed on. The failed node can be retrieved from GridFailoverContext.getJobResult().node() method.

GridGain comes with the following built-in failover SPI implementations:

NOTE: this SPI (i.e. methods in this interface) should never be used directly. SPIs provide internal view on the subsystem and is used internally by GridGain kernal. In rare use cases when access to a specific implementation of this SPI is required - an instance of this SPI can be obtained via Grid.configuration() method to check its configuration properties or call other non-SPI methods. Note again that calling methods from this interface on the obtained instance can lead to undefined behavior and explicitly not supported.

Wiki & Forum:


Wiki
Forum

 

Method Summary
 GridNode failover(GridFailoverContext ctx, List<GridNode> top)
          This method is called when method GridTask.result(GridJobResult, List) returns value GridJobResultPolicy.FAILOVER policy indicating that the result of job execution must be failed over.
 
Methods inherited from interface org.gridgain.grid.spi.GridSpi
getName, getNodeAttributes, onContextDestroyed, onContextInitialized, spiStart, spiStop
 
Methods inherited from interface org.gridgain.grid.spi.GridSpiJsonConfigurable
setJson
 

Method Detail

failover

GridNode failover(GridFailoverContext ctx,
                  List<GridNode> top)
This method is called when method GridTask.result(GridJobResult, List) returns value GridJobResultPolicy.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 GridFailoverContext.getBalancedNode(List) method is used to select node for execution of failed job.

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.

GridGain™ 3.6.0e
Enterprise Edition

GridGain - Real Time Big Data
Enterprise Edition, ver. 3.6.0e.13012012
2012 Copyright © GridGain Systems
Follow us:   Follow GridGain on Github Follow GridGain on Facebook Join GridGain User Group Follow GridGain on Twitter Follow GridGain on YouTube