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 |
---|---|
@Nullable Serializable |
consistentId()
Gets consistent ID.
|
void |
disconnect()
Tells discovery SPI to disconnect from topology.
|
void |
failNode(UUID nodeId,
@Nullable String warning)
Initiates failure of provided node.
|
long |
getGridStartTime()
Gets start time of the very first node in the grid.
|
ClusterNode |
getLocalNode()
Gets local node.
|
@Nullable 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.
|
void |
setDataExchange(DiscoverySpiDataExchange exchange)
Sets a handler for initial data exchange between Ignite nodes.
|
void |
setListener(@Nullable DiscoverySpiListener lsnr)
Deprecated.
|
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, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized, spiStart, spiStop
@Nullable @Nullable Serializable consistentId() throws IgniteSpiException
null
if not applicable.IgniteSpiException
- If failed.Collection<ClusterNode> getRemoteNodes()
ClusterNode getLocalNode()
@Nullable @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.@Deprecated void setListener(@Nullable @Nullable DiscoverySpiListener lsnr)
DiscoveryEvent
for a set of all possible
discovery events.
TODO: This method should be removed from public API in Apache Ignite 3.0
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(DiscoverySpiCustomMessage msg) throws IgniteException
msg
- Custom message.IgniteException
- if failed to sent the event message.void failNode(UUID nodeId, @Nullable @Nullable String warning)
nodeId
- Node ID.warning
- Warning to be shown on all cluster nodes.boolean isClientMode() throws IllegalStateException
true
if node is in client mode.IllegalStateException
- If discovery SPI has not started.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.16.0 Release Date : December 15 2023