public interface GridDiscoverySpi extends GridSpi
The default discovery SPI is GridTcpDiscoverySpi
with default configuration which allows all nodes in local network
(with enabled multicast) to discover each other.
Gridgain provides the following GridDeploymentSpi implementation:
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.| Modifier and Type | Method and Description |
|---|---|
void |
disconnect()
Tells discovery SPI to disconnect from topology.
|
long |
getGridStartTime()
Gets start time of the very first node in the grid.
|
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 |
setAuthenticator(GridDiscoverySpiNodeAuthenticator auth)
Sets discovery SPI node authenticator.
|
void |
setDataExchange(GridDiscoverySpiDataExchange exchange)
Sets a handler for initial data exchange between GridGain nodes.
|
void |
setListener(GridDiscoverySpiListener lsnr)
Sets a listener for discovery events.
|
void |
setMetricsProvider(GridDiscoveryMetricsProvider metricsProvider)
Sets discovery metrics provider.
|
void |
setNodeAttributes(Map<String,Object> attrs,
GridProductVersion ver)
Sets node attributes and node version which will be distributed in grid during
join process.
|
getName, getNodeAttributes, onContextDestroyed, onContextInitialized, spiStart, spiStopCollection<GridNode> getRemoteNodes()
GridNode getLocalNode()
@Nullable GridNode getNode(UUID nodeId)
nodeId - Node ID.null if node is not found.boolean pingNode(UUID nodeId)
nodeId - Node Id.true if node alive, false otherwise.void setNodeAttributes(Map<String,Object> attrs, GridProductVersion ver)
attrs - Map of node attributes.ver - Product version.void setListener(@Nullable GridDiscoverySpiListener lsnr)
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.
lsnr - Listener to discovery events or null to unset the listener.void setDataExchange(GridDiscoverySpiDataExchange exchange)
exchange - Discovery data exchange handler.void setMetricsProvider(GridDiscoveryMetricsProvider metricsProvider)
GridDiscoveryMetricsProvider.getMetrics() method to exchange
dynamic metrics between nodes.metricsProvider - Provider of metrics data.void disconnect()
throws GridSpiException
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).GridSpiException - If any error occurs.reconnect()void reconnect()
throws GridSpiException
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.
GridSpiException - If any error occurs.disconnect()void setAuthenticator(GridDiscoverySpiNodeAuthenticator auth)
auth - Discovery SPI authenticator.long getGridStartTime()
0 if SPI implementation
does not support this method.Copyright © 2014. All rights reserved.