Class ZookeeperDiscoverySpi
- java.lang.Object
- 
- org.apache.ignite.spi.IgniteSpiAdapter
- 
- org.apache.ignite.spi.discovery.zk.ZookeeperDiscoverySpi
 
 
- 
- All Implemented Interfaces:
- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi,- DiscoverySpi,- IgniteSpi
 
 @IgniteSpiMultipleInstancesSupport(true) @DiscoverySpiOrderSupport(true) @DiscoverySpiHistorySupport(true) @DiscoverySpiMutableCustomMessageSupport(false) public class ZookeeperDiscoverySpi extends IgniteSpiAdapter implements org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi Zookeeper Discovery Spi.
- 
- 
Field SummaryFields Modifier and Type Field Description static longDFLT_JOIN_TIMEOUTstatic StringDFLT_ROOT_PATH- 
Fields inherited from class org.apache.ignite.spi.IgniteSpiAdapterignite, igniteInstanceName
 
- 
 - 
Constructor SummaryConstructors Constructor Description ZookeeperDiscoverySpi()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallNodesSupport(org.apache.ignite.internal.IgniteFeatures feature)voidclientReconnect()booleanclientReconnectSupported()@Nullable SerializableconsistentId()Gets consistent ID.voiddisconnect()Tells discovery SPI to disconnect from topology.voidfailNode(UUID nodeId, @Nullable String warning)Initiates failure of provided node.DiscoverySpiNodeAuthenticatorgetAuthenticator()longgetGridStartTime()Gets start time of the very first node in the grid.longgetJoinTimeout()ClusterNodegetLocalNode()Gets local node.Map<String,Object>getLocNodeAttrs()@Nullable ClusterNodegetNode(UUID nodeId)Gets node by ID.Collection<ClusterNode>getRemoteNodes()Gets collection of remote nodes in grid or empty collection if no remote nodes found.longgetSessionTimeout()StringgetZkConnectionString()StringgetZkRootPath()booleanisClientMode()Whether or not discovery is started in client mode.booleanisClientReconnectDisabled()Iftrueclient does not try to reconnect.booleanknownNode(UUID nodeId)protected voidonContextInitialized0(IgniteSpiContext spiCtx)Method to be called in the end of onContextInitialized method.booleanpingNode(UUID nodeId)Pings the remote node to see if it's alive.voidresolveCommunicationFailure(ClusterNode node, Exception err)voidsendCustomEvent(DiscoverySpiCustomMessage msg)Sends custom message across the ring.voidsetAuthenticator(DiscoverySpiNodeAuthenticator auth)Sets discovery SPI node authenticator.ZookeeperDiscoverySpisetClientReconnectDisabled(boolean clientReconnectDisabled)Sets client reconnect disabled flag.voidsetDataExchange(DiscoverySpiDataExchange exchange)Sets a handler for initial data exchange between Ignite nodes.voidsetInternalListener(org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpiInternalListener lsnr)For TESTING only.ZookeeperDiscoverySpisetJoinTimeout(long joinTimeout)voidsetListener(@Nullable DiscoverySpiListener lsnr)Sets a listener for discovery events.voidsetMetricsProvider(DiscoveryMetricsProvider metricsProvider)Sets discovery metrics provider.voidsetNodeAttributes(Map<String,Object> attrs, IgniteProductVersion ver)Sets node attributes and node version which will be distributed in grid during join process.ZookeeperDiscoverySpisetSessionTimeout(long sesTimeout)ZookeeperDiscoverySpisetZkConnectionString(String zkConnectionString)ZookeeperDiscoverySpisetZkRootPath(String zkRootPath)voidsimulateNodeFailure()For TESTING only.voidspiStart(@Nullable String igniteInstanceName)This method is called to start SPI.voidspiStop()This method is called to stop SPI.booleansupportsCommunicationFailureResolve()StringtoString()- 
Methods inherited from class org.apache.ignite.spi.IgniteSpiAdapteraddTimeoutObject, assertParameter, checkConfigurationConsistency0, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, getConsistentAttributeNames, getExceptionRegistry, getName, getNodeAttributes, getSpiContext, ignite, initFailureDetectionTimeout, injectables, injectResources, isNodeStopping, onBeforeStart, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextDestroyed0, onContextInitialized, registerMBean, removeTimeoutObject, setName, started, startInfo, startStopwatch, stopInfo, unregisterMBean
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.apache.ignite.spi.IgniteSpigetName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized
 
- 
 
- 
- 
- 
Field Detail- 
DFLT_ROOT_PATHpublic static final String DFLT_ROOT_PATH - See Also:
- Constant Field Values
 
 - 
DFLT_JOIN_TIMEOUTpublic static final long DFLT_JOIN_TIMEOUT - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getZkRootPathpublic String getZkRootPath() - Returns:
- Base path in ZK for znodes created by SPI.
 
 - 
setZkRootPath@IgniteSpiConfiguration(optional=true) public ZookeeperDiscoverySpi setZkRootPath(String zkRootPath) - Parameters:
- zkRootPath- Base path in ZooKeeper for znodes created by SPI.
- Returns:
- thisfor chaining.
 
 - 
getSessionTimeoutpublic long getSessionTimeout() - Returns:
- ZooKeeper session timeout.
 
 - 
setSessionTimeout@IgniteSpiConfiguration(optional=true) public ZookeeperDiscoverySpi setSessionTimeout(long sesTimeout) - Parameters:
- sesTimeout- ZooKeeper session timeout.
- Returns:
- thisfor chaining.
 
 - 
getJoinTimeoutpublic long getJoinTimeout() - Returns:
- Cluster join timeout.
 
 - 
setJoinTimeout@IgniteSpiConfiguration(optional=true) public ZookeeperDiscoverySpi setJoinTimeout(long joinTimeout) - Parameters:
- joinTimeout- Cluster join timeout (- 0means wait forever).
- Returns:
- thisfor chaining.
 
 - 
getZkConnectionStringpublic String getZkConnectionString() - Returns:
- ZooKeeper connection string
 
 - 
setZkConnectionString@IgniteSpiConfiguration(optional=false) public ZookeeperDiscoverySpi setZkConnectionString(String zkConnectionString) - Parameters:
- zkConnectionString- ZooKeeper connection string
- Returns:
- thisfor chaining.
 
 - 
isClientReconnectDisabledpublic boolean isClientReconnectDisabled() Iftrueclient does not try to reconnect.- Returns:
- Client reconnect disabled flag.
 
 - 
setClientReconnectDisabled@IgniteSpiConfiguration(optional=true) public ZookeeperDiscoverySpi setClientReconnectDisabled(boolean clientReconnectDisabled) Sets client reconnect disabled flag.- Parameters:
- clientReconnectDisabled- Client reconnect disabled flag.
- Returns:
- thisfor chaining.
 
 - 
clientReconnectSupportedpublic boolean clientReconnectSupported() - Specified by:
- clientReconnectSupportedin interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
- Returns:
- Trueif SPI supports client reconnect.
 
 - 
clientReconnectpublic void clientReconnect() - Specified by:
- clientReconnectin interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
 
 - 
knownNodepublic boolean knownNode(UUID nodeId) - Specified by:
- knownNodein interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
- Parameters:
- nodeId- Node ID.
- Returns:
- Trueif node joining or already joined topology.
 
 - 
supportsCommunicationFailureResolvepublic boolean supportsCommunicationFailureResolve() - Specified by:
- supportsCommunicationFailureResolvein interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
- Returns:
- Trueif supports communication error resolve.
 
 - 
resolveCommunicationFailurepublic void resolveCommunicationFailure(ClusterNode node, Exception err) - Specified by:
- resolveCommunicationFailurein interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
- Parameters:
- node- Problem node.
- err- Connection error.
 
 - 
consistentId@Nullable public @Nullable Serializable consistentId() throws IgniteSpiException Gets consistent ID.- Specified by:
- consistentIdin interface- DiscoverySpi
- Returns:
- Consistent ID of this Ignite instance or nullif not applicable.
- Throws:
- IgniteSpiException- If failed.
 
 - 
getRemoteNodespublic Collection<ClusterNode> getRemoteNodes() Gets collection of remote nodes in grid or empty collection if no remote nodes found.- Specified by:
- getRemoteNodesin interface- DiscoverySpi
- Returns:
- Collection of remote nodes.
 
 - 
allNodesSupportpublic boolean allNodesSupport(org.apache.ignite.internal.IgniteFeatures feature) - Specified by:
- allNodesSupportin interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
- Parameters:
- feature- Feature to check.
- Returns:
- trueif all nodes support the given feature.
 
 - 
getLocalNodepublic ClusterNode getLocalNode() Gets local node.- Specified by:
- getLocalNodein interface- DiscoverySpi
- Overrides:
- getLocalNodein class- IgniteSpiAdapter
- Returns:
- Local node.
 
 - 
getNode@Nullable public @Nullable ClusterNode getNode(UUID nodeId) Gets node by ID.- Specified by:
- getNodein interface- DiscoverySpi
- Parameters:
- nodeId- Node ID.
- Returns:
- Node with given ID or nullif node is not found.
 
 - 
pingNodepublic boolean pingNode(UUID nodeId) Pings the remote node to see if it's alive.- Specified by:
- pingNodein interface- DiscoverySpi
- Parameters:
- nodeId- Node Id.
- Returns:
- trueif node alive,- falseotherwise.
 
 - 
setNodeAttributespublic void setNodeAttributes(Map<String,Object> attrs, IgniteProductVersion ver) Sets node attributes and node version which will be distributed in grid during join process. Note that these attributes cannot be changed and set only once. set- Specified by:
- setNodeAttributesin interface- DiscoverySpi
- Parameters:
- attrs- Map of node attributes.
- ver- Product version.
 
 - 
setListenerpublic void setListener(@Nullable @Nullable DiscoverySpiListener lsnr)Sets a listener for discovery events. Refer toDiscoveryEventfor a set of all possible discovery events.TODO: This method should be removed from public API in Apache Ignite 3.0 - Specified by:
- setListenerin interface- DiscoverySpi
- Parameters:
- lsnr- Listener to discovery events or- nullto unset the listener.
 
 - 
setDataExchangepublic void setDataExchange(DiscoverySpiDataExchange exchange) Sets a handler for initial data exchange between Ignite nodes.- Specified by:
- setDataExchangein interface- DiscoverySpi
- Parameters:
- exchange- Discovery data exchange handler.
 
 - 
setMetricsProviderpublic void setMetricsProvider(DiscoveryMetricsProvider metricsProvider) Sets discovery metrics provider. Use metrics provided byDiscoveryMetricsProvider.metrics()method to exchange dynamic metrics between nodes.- Specified by:
- setMetricsProviderin interface- DiscoverySpi
- Parameters:
- metricsProvider- Provider of metrics data.
 
 - 
disconnectpublic void disconnect() throws IgniteSpiExceptionTells discovery SPI to disconnect from topology. This is very close to callingIgniteSpi.spiStop()with accounting that it is not a full stop, but disconnect due to segmentation.- Specified by:
- disconnectin interface- DiscoverySpi
- Throws:
- IgniteSpiException- If any error occurs.
 
 - 
setAuthenticatorpublic void setAuthenticator(DiscoverySpiNodeAuthenticator auth) Sets discovery SPI node authenticator. This method is called before SPI start() method.- Specified by:
- setAuthenticatorin interface- DiscoverySpi
- Parameters:
- auth- Discovery SPI authenticator.
 
 - 
getAuthenticatorpublic DiscoverySpiNodeAuthenticator getAuthenticator() - Returns:
- Authenticator.
 
 - 
getGridStartTimepublic long getGridStartTime() Gets start time of the very first node in the grid. This value should be the same on all nodes in the grid and it should not change even if very first node fails of leaves grid.- Specified by:
- getGridStartTimein interface- DiscoverySpi
- Returns:
- Start time of the first node in grid or 0if SPI implementation does not support this method.
 
 - 
sendCustomEventpublic void sendCustomEvent(DiscoverySpiCustomMessage msg) Sends custom message across the ring.- Specified by:
- sendCustomEventin interface- DiscoverySpi
- Parameters:
- msg- Custom message.
 
 - 
failNodepublic void failNode(UUID nodeId, @Nullable @Nullable String warning) Initiates failure of provided node.- Specified by:
- failNodein interface- DiscoverySpi
- Parameters:
- nodeId- Node ID.
- warning- Warning to be shown on all cluster nodes.
 
 - 
isClientModepublic boolean isClientMode() throws IllegalStateExceptionWhether or not discovery is started in client mode.- Specified by:
- isClientModein interface- DiscoverySpi
- Returns:
- trueif node is in client mode.
- Throws:
- IllegalStateException- If discovery SPI has not started.
 
 - 
spiStartpublic void spiStart(@Nullable @Nullable String igniteInstanceName) throws IgniteSpiExceptionThis method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.- Specified by:
- spiStartin interface- IgniteSpi
- Parameters:
- igniteInstanceName- Name of Ignite instance this SPI is being started for (- nullfor default Ignite instance).
- Throws:
- IgniteSpiException- Throws in case of any error during SPI start.
 
 - 
onContextInitialized0protected void onContextInitialized0(IgniteSpiContext spiCtx) throws IgniteSpiException Method to be called in the end of onContextInitialized method.- Overrides:
- onContextInitialized0in class- IgniteSpiAdapter
- Parameters:
- spiCtx- SPI context.
- Throws:
- IgniteSpiException- In case of errors.
 
 - 
setInternalListenerpublic void setInternalListener(org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpiInternalListener lsnr) For TESTING only.- Specified by:
- setInternalListenerin interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
- Parameters:
- lsnr- Listener.
 
 - 
simulateNodeFailurepublic void simulateNodeFailure() For TESTING only.- Specified by:
- simulateNodeFailurein interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
 
 - 
spiStoppublic void spiStop() throws IgniteSpiExceptionThis method is called to stop SPI. After this method returns kernel assumes that this SPI is finished and all resources acquired by it are released.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. - Specified by:
- spiStopin interface- IgniteSpi
- Throws:
- IgniteSpiException- Thrown in case of any error during SPI stop.
 
 
- 
 
-