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.
|
void |
failNode(UUID nodeId)
Initiates failure of provided node.
|
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 |
isClientMode()
Whether or not discovery is started in client mode.
|
boolean |
pingNode(UUID nodeId)
Pings the remote node to see if it's alive.
|
void |
sendCustomEvent(DiscoverySpiCustomMessage msg)
Sends custom message across the ring.
|
void |
setAuthenticator(DiscoverySpiNodeAuthenticator auth)
Sets discovery SPI node authenticator.
|
TcpDiscoverySpi |
setDataExchange(DiscoverySpiDataExchange exchange)
Sets a handler for initial data exchange between Ignite nodes.
|
void |
setListener(DiscoverySpiListener lsnr)
Sets a listener for discovery events.
|
TcpDiscoverySpi |
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.TcpDiscoverySpi setDataExchange(DiscoverySpiDataExchange exchange)
exchange
- Discovery data exchange handler.TcpDiscoverySpi 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(DiscoverySpiCustomMessage msg) throws IgniteException
msg
- Custom message.IgniteException
- if failed to marshal evt.void failNode(UUID nodeId)
nodeId
- Node ID.boolean isClientMode() throws IllegalStateException
true
if node is in client mode.IllegalStateException
- If discovery SPI has not started.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.2.0-incubating Release Date : June 16 2015