public interface DiscoverySpi extends IgniteSpi
The default discovery SPI is TcpDiscoverySpi
with default configuration which allows all nodes in local network
(with enabled multicast) to discover each other.
Ignite provides the following GridDeploymentSpi
implementation:
Ignite.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.
|
ClusterNode |
getLocalNode()
Gets local node.
|
ClusterNode |
getNode(UUID nodeId)
Gets node by ID.
|
Collection<ClusterNode> |
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 |
sendCustomEvent(Serializable evt)
Sends custom message across the ring.
|
void |
setAuthenticator(DiscoverySpiNodeAuthenticator auth)
Sets discovery SPI node authenticator.
|
void |
setDataExchange(DiscoverySpiDataExchange exchange)
Sets a handler for initial data exchange between Ignite nodes.
|
void |
setListener(DiscoverySpiListener lsnr)
Sets a listener for discovery events.
|
void |
setMetricsProvider(DiscoveryMetricsProvider metricsProvider)
Sets discovery metrics provider.
|
void |
setNodeAttributes(Map<String,Object> attrs,
IgniteProductVersion ver)
Sets node attributes and node version which will be distributed in grid during
join process.
|
getName, getNodeAttributes, onContextDestroyed, onContextInitialized, spiStart, spiStop
Collection<ClusterNode> getRemoteNodes()
ClusterNode getLocalNode()
@Nullable ClusterNode 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, IgniteProductVersion ver)
attrs
- Map of node attributes.ver
- Product version.void setListener(@Nullable DiscoverySpiListener lsnr)
DiscoveryEvent
for a set of all possible
discovery events.
Note that as of Ignite 3.0.2 this method is called before
method IgniteSpi.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(DiscoverySpiDataExchange exchange)
exchange
- Discovery data exchange handler.void setMetricsProvider(DiscoveryMetricsProvider metricsProvider)
DiscoveryMetricsProvider.metrics()
method to exchange
dynamic metrics between nodes.metricsProvider
- Provider of metrics data.void disconnect() throws IgniteSpiException
IgniteSpi.spiStop()
with accounting that it is not a full stop,
but disconnect due to segmentation.IgniteSpiException
- If any error occurs.void setAuthenticator(DiscoverySpiNodeAuthenticator auth)
auth
- Discovery SPI authenticator.long getGridStartTime()
0
if SPI implementation
does not support this method.void sendCustomEvent(Serializable evt)
evt
- Event.
Follow @ApacheIgnite
Apache Ignite Fabric : ver. 1.0.0-RC3 Release Date : March 24 2015