@IgniteSpiMultipleInstancesSupport(value=true) @DiscoverySpiOrderSupport(value=true) @DiscoverySpiHistorySupport(value=true) @DiscoverySpiMutableCustomMessageSupport(value=false) public class ZookeeperDiscoverySpi extends IgniteSpiAdapter implements org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
Modifier and Type | Field and Description |
---|---|
static long |
DFLT_JOIN_TIMEOUT |
static String |
DFLT_ROOT_PATH |
ignite, igniteInstanceName
Constructor and Description |
---|
ZookeeperDiscoverySpi() |
Modifier and Type | Method and Description |
---|---|
boolean |
allNodesSupport(org.apache.ignite.internal.IgniteFeatures feature) |
boolean |
allNodesSupport(org.apache.ignite.internal.IgniteFeatures feature,
IgnitePredicate<ClusterNode> nodesPred) |
void |
clientReconnect() |
boolean |
clientReconnectSupported() |
@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.
|
DiscoverySpiNodeAuthenticator |
getAuthenticator() |
long |
getGridStartTime()
Gets start time of the very first node in the grid.
|
long |
getJoinTimeout() |
ClusterNode |
getLocalNode()
Gets local node.
|
Map<String,Object> |
getLocNodeAttrs() |
@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.
|
long |
getSessionTimeout() |
String |
getZkConnectionString() |
String |
getZkRootPath() |
boolean |
isClientMode()
Whether or not discovery is started in client mode.
|
boolean |
isClientReconnectDisabled()
If
true client does not try to reconnect. |
boolean |
knownNode(UUID nodeId) |
boolean |
pingNode(UUID nodeId)
Pings the remote node to see if it's alive.
|
void |
resolveCommunicationFailure(ClusterNode node,
Exception err) |
void |
sendCustomEvent(DiscoverySpiCustomMessage msg)
Sends custom message across the ring.
|
void |
setAuthenticator(DiscoverySpiNodeAuthenticator auth)
Sets discovery SPI node authenticator.
|
ZookeeperDiscoverySpi |
setClientReconnectDisabled(boolean clientReconnectDisabled)
Sets client reconnect disabled flag.
|
void |
setDataExchange(DiscoverySpiDataExchange exchange)
Sets a handler for initial data exchange between Ignite nodes.
|
void |
setGridStartTime(long val)
Sets grid start time.
|
void |
setInternalListener(org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpiInternalListener lsnr)
For TESTING only.
|
ZookeeperDiscoverySpi |
setJoinTimeout(long joinTimeout) |
void |
setListener(@Nullable 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.
|
ZookeeperDiscoverySpi |
setSessionTimeout(long sesTimeout) |
ZookeeperDiscoverySpi |
setZkConnectionString(String zkConnectionString) |
ZookeeperDiscoverySpi |
setZkRootPath(String zkRootPath) |
void |
simulateNodeFailure()
For TESTING only.
|
void |
spiStart(@Nullable String igniteInstanceName)
This method is called to start SPI.
|
void |
spiStop()
This method is called to stop SPI.
|
boolean |
supportsCommunicationFailureResolve() |
String |
toString() |
addTimeoutObject, assertParameter, checkConfigurationConsistency0, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, getConsistentAttributeNames, getExceptionRegistry, getName, getNodeAttributes, getSpiContext, ignite, initFailureDetectionTimeout, injectables, injectResources, isNodeStopping, onBeforeStart, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextDestroyed0, onContextInitialized, onContextInitialized0, registerMBean, removeTimeoutObject, setName, started, startInfo, startStopwatch, stopInfo, unregisterMBean
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized
public static final String DFLT_ROOT_PATH
public static final long DFLT_JOIN_TIMEOUT
public String getZkRootPath()
@IgniteSpiConfiguration(optional=true) public ZookeeperDiscoverySpi setZkRootPath(String zkRootPath)
zkRootPath
- Base path in ZooKeeper for znodes created by SPI.this
for chaining.public long getSessionTimeout()
@IgniteSpiConfiguration(optional=true) public ZookeeperDiscoverySpi setSessionTimeout(long sesTimeout)
sesTimeout
- ZooKeeper session timeout.this
for chaining.public long getJoinTimeout()
@IgniteSpiConfiguration(optional=true) public ZookeeperDiscoverySpi setJoinTimeout(long joinTimeout)
joinTimeout
- Cluster join timeout (0
means wait forever).this
for chaining.public String getZkConnectionString()
@IgniteSpiConfiguration(optional=false) public ZookeeperDiscoverySpi setZkConnectionString(String zkConnectionString)
zkConnectionString
- ZooKeeper connection stringthis
for chaining.public boolean isClientReconnectDisabled()
true
client does not try to reconnect.@IgniteSpiConfiguration(optional=true) public ZookeeperDiscoverySpi setClientReconnectDisabled(boolean clientReconnectDisabled)
clientReconnectDisabled
- Client reconnect disabled flag.this
for chaining.public boolean clientReconnectSupported()
clientReconnectSupported
in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
True
if SPI supports client reconnect.public void clientReconnect()
clientReconnect
in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
public boolean knownNode(UUID nodeId)
knownNode
in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
nodeId
- Node ID.True
if node joining or already joined topology.public boolean supportsCommunicationFailureResolve()
supportsCommunicationFailureResolve
in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
True
if supports communication error resolve.public void resolveCommunicationFailure(ClusterNode node, Exception err)
resolveCommunicationFailure
in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
node
- Problem node.err
- Connection error.@Nullable public @Nullable Serializable consistentId() throws IgniteSpiException
consistentId
in interface DiscoverySpi
null
if not applicable.IgniteSpiException
- If failed.public Collection<ClusterNode> getRemoteNodes()
getRemoteNodes
in interface DiscoverySpi
public boolean allNodesSupport(org.apache.ignite.internal.IgniteFeatures feature)
allNodesSupport
in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
feature
- Feature to check.true
if all nodes support the given feature.public boolean allNodesSupport(org.apache.ignite.internal.IgniteFeatures feature, IgnitePredicate<ClusterNode> nodesPred)
allNodesSupport
in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
feature
- Feature to check.nodesPred
- Predicate to filter cluster nodes.true
if all nodes passed the filter support the given feature.public ClusterNode getLocalNode()
getLocalNode
in interface DiscoverySpi
getLocalNode
in class IgniteSpiAdapter
@Nullable public @Nullable ClusterNode getNode(UUID nodeId)
getNode
in interface DiscoverySpi
nodeId
- Node ID.null
if node is not found.public boolean pingNode(UUID nodeId)
pingNode
in interface DiscoverySpi
nodeId
- Node Id.true
if node alive, false
otherwise.public void setNodeAttributes(Map<String,Object> attrs, IgniteProductVersion ver)
setNodeAttributes
in interface DiscoverySpi
attrs
- Map of node attributes.ver
- Product version.public 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
setListener
in interface DiscoverySpi
lsnr
- Listener to discovery events or null
to unset the listener.public void setDataExchange(DiscoverySpiDataExchange exchange)
setDataExchange
in interface DiscoverySpi
exchange
- Discovery data exchange handler.public void setMetricsProvider(DiscoveryMetricsProvider metricsProvider)
DiscoveryMetricsProvider.metrics()
method to exchange
dynamic metrics between nodes.setMetricsProvider
in interface DiscoverySpi
metricsProvider
- Provider of metrics data.public void disconnect() throws IgniteSpiException
IgniteSpi.spiStop()
with accounting that it is not a full stop,
but disconnect due to segmentation.disconnect
in interface DiscoverySpi
IgniteSpiException
- If any error occurs.public void setAuthenticator(DiscoverySpiNodeAuthenticator auth)
setAuthenticator
in interface DiscoverySpi
auth
- Discovery SPI authenticator.public DiscoverySpiNodeAuthenticator getAuthenticator()
public long getGridStartTime()
getGridStartTime
in interface DiscoverySpi
0
if SPI implementation
does not support this method.public void setGridStartTime(long val)
val
- New time value.public void sendCustomEvent(DiscoverySpiCustomMessage msg)
sendCustomEvent
in interface DiscoverySpi
msg
- Custom message.public void failNode(UUID nodeId, @Nullable @Nullable String warning)
failNode
in interface DiscoverySpi
nodeId
- Node ID.warning
- Optional warning to be shown on all cluster nodes.public boolean isClientMode() throws IllegalStateException
isClientMode
in interface DiscoverySpi
true
if node is in client mode.IllegalStateException
- If discovery SPI has not started.public void spiStart(@Nullable @Nullable String igniteInstanceName) throws IgniteSpiException
spiStart
in interface IgniteSpi
igniteInstanceName
- Name of Ignite instance this SPI is being started for
(null
for default Ignite instance).IgniteSpiException
- Throws in case of any error during SPI start.public void setInternalListener(org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpiInternalListener lsnr)
setInternalListener
in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
lsnr
- Listener.public void simulateNodeFailure()
simulateNodeFailure
in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
public void spiStop() throws IgniteSpiException
Note that this method can be called at any point including during recovery of failed start. It should make no assumptions on what state SPI will be in when this method is called.
spiStop
in interface IgniteSpi
IgniteSpiException
- Thrown in case of any error during SPI stop.
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024