GridGain™ 2.1.0
Java API Specification

org.gridgain.grid.spi.failover.never
Class GridNeverFailoverSpi

java.lang.Object
  extended by org.gridgain.grid.spi.GridSpiAdapter
      extended by org.gridgain.grid.spi.failover.never.GridNeverFailoverSpi
All Implemented Interfaces:
GridFailoverSpi, GridNeverFailoverSpiMBean, GridSpi, GridSpiManagementMBean

@GridSpiInfo(author="GridGain Systems",
             url="www.gridgain.org",
             email="support@gridgain.com",
             version="x.x")
@GridSpiMultipleInstancesSupport(value=true)
public class GridNeverFailoverSpi
extends GridSpiAdapter
implements GridFailoverSpi, GridNeverFailoverSpiMBean

This class provides failover SPI implementation that never fails over. This implementation never fails over a failed job by always returning null out of GridFailoverSpi.failover(GridFailoverContext, 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:

 GridJobStealingFailoverSpi spi = new GridJobStealingFailoverSpi();
 
 // Override maximum failover attempts.
 spi.setMaximumFailoverAttempts(5);
 
 GridConfigurationAdapter cfg = new GridConfigurationAdapter();
 
 // Override default failover SPI.
 cfg.setFailoverSpiSpi(spi);
 
 // Start grid.
 GridFactory.start(cfg);  
 
Here is an example on how to configure grid with GridNeverFailoverSpi from Spring XML configuration file:
 <property name="failoverSpi">
     <bean class="org.gridgain.grid.spi.failover.never.GridNeverFailoverSpi"/>
 </property>
 


For information about Spring framework visit www.springframework.org



See Also:

  Documentation
  Email Support
  Online Forums
  Issue Tracking

Author:   2005-2008 Copyright © GridGain Systems. All Rights Reserved. ver. 2.1.0

See Also:
GridFailoverSpi
 

Constructor Summary
GridNeverFailoverSpi()
           
 
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.
 void spiStart(String gridName)
          This method is called to start SPI.
 void spiStop()
          This method is called to stop SPI.
 String toString()
          
 
Methods inherited from class org.gridgain.grid.spi.GridSpiAdapter
assertParameter, configInfo, createSpiAttributeName, getAuthor, getConsistentAttributeNames, getGridGainHome, getLocalNodeId, getName, getNodeAttributes, getSpiContext, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion, onContextDestroyed, onContextInitialized, registerMBean, setName, setSpiContext, 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.gridgain.grid.spi.GridSpi
getName, getNodeAttributes, onContextDestroyed, onContextInitialized
 
Methods inherited from interface org.gridgain.grid.spi.GridSpiManagementMBean
getAuthor, getGridGainHome, getLocalNodeId, getName, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion
 

Constructor Detail

GridNeverFailoverSpi

public GridNeverFailoverSpi()
Method Detail

spiStart

public void spiStart(String gridName)
              throws GridSpiException
This method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.

Specified by:
spiStart in interface GridSpi
Throws:
GridSpiException - Throws in case of any error during SPI start.
Parameters:
gridName - Name of grid instance this SPI is being started for (null for default grid).

spiStop

public void spiStop()
             throws GridSpiException
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 GridSpi
Throws:
GridSpiException - Thrown in case of any error during SPI stop.

failover

public 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.

Specified by:
failover in interface GridFailoverSpi
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.

toString

public String toString()

Overrides:
toString in class Object

GridGain™ 2.1.0
Java API Specification

GridGain™ - Grid Computing Made Simple, ver. 2.1.0.19122008
2005-2008 Copyright © GridGain Systems. All Rights Reserved.