GridGain™ 2.0.3
Java API Specification

org.gridgain.grid.spi.topology.attributes
Class GridAttributesTopologySpi

java.lang.Object
  extended by org.gridgain.grid.spi.GridSpiAdapter
      extended by org.gridgain.grid.spi.topology.attributes.GridAttributesTopologySpi
All Implemented Interfaces:
GridSpi, GridSpiManagementMBean, GridAttributesTopologySpiMBean, GridTopologySpi

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

This class provides attribute based implementation for topology SPI. This implementation always returns all nodes (local and remote) that have attributes provided in configuration with given values. If no attributes were provided, all nodes, local and remote, will be included into topology.

Configuration

Mandatory

This SPI has no mandatory configuration parameters.

Optional

This SPI has following optional configuration parameters:



See Also:

  Documentation
  Email Support
  Online Forums
  Issue Tracking

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

 

Constructor Summary
GridAttributesTopologySpi()
           
 
Method Summary
 Map<String,Serializable> getAttributes()
          Gets attribute names and values that nodes should have to be included in topology.
 Collection<GridNode> getTopology(GridTaskSession ses, Collection<GridNode> grid)
          This method is called by GridGain right before calling GridTask.map(List, Object) to obtain a topology for the task's split.
 void setAttributes(Map<String,Serializable> attrs)
          Sets attributes that all nodes should have, to be in topology.
 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, checkConfigurationConsistency, configInfo, getAuthor, getGridGainHome, getLocalNodeId, getNodeAttributes, getSpiContext, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion, onContextDestroyed, onContextInitialized, registerMBean, setSpiContext, startInfo, startStopwatch, stopInfo, unregisterMBean, warnSpi, warnSpiParameter
 
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
getNodeAttributes, onContextDestroyed, onContextInitialized
 
Methods inherited from interface org.gridgain.grid.spi.GridSpiManagementMBean
getAuthor, getGridGainHome, getLocalNodeId, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted, getVendorEmail, getVendorUrl, getVersion
 

Constructor Detail

GridAttributesTopologySpi

public GridAttributesTopologySpi()
Method Detail

getAttributes

public Map<String,Serializable> getAttributes()
Gets attribute names and values that nodes should have to be included in topology.

Default value is null which means all nodes will be added.

Specified by:
getAttributes in interface GridAttributesTopologySpiMBean
Returns:
Map of node attributes.

setAttributes

@GridSpiConfiguration(optional=true)
public void setAttributes(Map<String,Serializable> attrs)
Sets attributes that all nodes should have, to be in topology.

Parameters:
attrs - Map of node attributes.

getTopology

public Collection<GridNode> getTopology(GridTaskSession ses,
                                        Collection<GridNode> grid)
                                 throws GridException
This method is called by GridGain right before calling GridTask.map(List, Object) to obtain a topology for the task's split.

Specified by:
getTopology in interface GridTopologySpi
Throws:
GridException - Thrown in case if topology cannot be obtained.
Parameters:
ses - Current task's session. If implementation does not depend on task's information it may ignore it.
grid - Full set of all grid nodes.
Returns:
Topology to use for execution of the task represented by the session passed in.

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.

toString

public String toString()

Overrides:
toString in class Object

GridGain™ 2.0.3
Java API Specification

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