Package org.apache.ignite.spi.failover
Interface FailoverSpi
-
- All Superinterfaces:
IgniteSpi
- All Known Implementing Classes:
AlwaysFailoverSpi
,JobStealingFailoverSpi
,NeverFailoverSpi
public interface FailoverSpi extends IgniteSpi
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:- Job execution threw an exception (runtime, assertion or error)
- Node on which job was execution left topology (crashed or stopped)
- Collision SPI on remote node cancelled a job before it got a chance to execute (job rejection).
GridFailoverContext.getJobResult().node()
method.Ignite 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 Ignite kernal. In rare use cases when access to a specific implementation of this SPI is required - an instance of this SPI can be obtained viaIgnite.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.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ClusterNode
failover(FailoverContext ctx, List<ClusterNode> top)
This method is called when methodComputeTask.result(org.apache.ignite.compute.ComputeJobResult, List)
returns valueComputeJobResultPolicy.FAILOVER
policy indicating that the result of job execution must be failed over.-
Methods inherited from interface org.apache.ignite.spi.IgniteSpi
getName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized, spiStart, spiStop
-
-
-
-
Method Detail
-
failover
ClusterNode failover(FailoverContext ctx, List<ClusterNode> top)
This method is called when methodComputeTask.result(org.apache.ignite.compute.ComputeJobResult, List)
returns valueComputeJobResultPolicy.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 suppliedtopology
to retry job execution on it. For best performance it is advised thatFailoverContext.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 (returnsnull
) the whole task will be failed.
-
-