GridGain™ 3.6.0e
Enterprise Edition

org.gridgain.grid.spi.discovery
Interface GridDiscoverySpi

All Superinterfaces:
GridSpi, GridSpiJsonConfigurable
All Known Implementing Classes:
GridMulticastDiscoverySpi, GridTcpDiscoverySpi

public interface GridDiscoverySpi
extends GridSpi, GridSpiJsonConfigurable

Grid discovery SPI allows to discover remote nodes in grid.

The default discovery SPI is GridMulticastDiscoverySpi with default configuration which allows all nodes in local network (with enabled multicast) to discover each other.

Gridgain provides the following GridDeploymentSpi 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
 void disconnect()
          Tells discovery SPI to disconnect from topology.
 GridNode getLocalNode()
          Gets local node.
 GridNode getNode(UUID nodeId)
          Gets node by ID.
 Collection<GridNode> getRemoteNodes()
          Gets collection of remote nodes in grid or empty collection if no remote nodes found.
 boolean pingNode(UUID nodeId)
          Pings the remote node to see if it's alive.
 void reconnect()
          Tells discovery SPI to reconnect to topology.
 void setListener(GridDiscoverySpiListener lsnr)
          Sets a listener for discovery events.
 void setMetricsProvider(GridDiscoveryMetricsProvider metricsProvider)
          Sets discovery metrics provider.
 void setNodeAttributes(Map<String,Object> attrs)
          Sets node attributes which will be distributed in grid during join process.
 
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

getRemoteNodes

Collection<GridNode> getRemoteNodes()
Gets collection of remote nodes in grid or empty collection if no remote nodes found.

Returns:
Collection of remote nodes.

getLocalNode

GridNode getLocalNode()
Gets local node.

Returns:
Local node.

getNode

@Nullable
GridNode getNode(UUID nodeId)
Gets node by ID.

Parameters:
nodeId - Node ID.
Returns:
Node with given ID or null if node is not found.

pingNode

boolean pingNode(UUID nodeId)
Pings the remote node to see if it's alive.

Parameters:
nodeId - Node Id.
Returns:
true if node alive, false otherwise.

setNodeAttributes

void setNodeAttributes(Map<String,Object> attrs)
Sets node attributes which will be distributed in grid during join process. Note that these attributes cannot be changed and set only once.

Parameters:
attrs - Map of node attributes.

setListener

void setListener(@Nullable
                 GridDiscoverySpiListener lsnr)
Sets a listener for discovery events. Refer to GridDiscoveryEvent for a set of all possible discovery events.

Note that as of GridGain 3.0.2 this method is called before method GridSpi.spiStart(String) is called. This is done to avoid potential window when SPI is started but the listener is not registered yet.

Parameters:
lsnr - Listener to discovery events or null to unset the listener.

setMetricsProvider

void setMetricsProvider(GridDiscoveryMetricsProvider metricsProvider)
Sets discovery metrics provider. Use metrics provided by GridDiscoveryMetricsProvider.getMetrics() method to exchange dynamic metrics between nodes.

Parameters:
metricsProvider - Provider of metrics data.

disconnect

void disconnect()
                throws GridSpiException
Tells discovery SPI to disconnect from topology. This is very close to calling GridSpi.spiStop() with accounting that it is not a full stop, but disconnect before reconnect (i.e. some internal threads and resources may be preserved on disconnect and reused on reconnect again).

Throws:
GridSpiException - If any error occurs.
See Also:
GridDiscoverySpi.reconnect()

reconnect

void reconnect()
               throws GridSpiException
Tells discovery SPI to reconnect to topology. This is very close to calling GridSpi.spiStart(String) with accounting that it is not a full start, but reconnect (i.e. some internal threads and resources may be preserved on disconnect and reused on reconnect again).

Prior to calling this method manager will ensure, that it is in the correct network segment.

Throws:
GridSpiException - If any error occurs.
See Also:
GridDiscoverySpi.disconnect()

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