public class TcpDiscoveryZookeeperIpFinder extends TcpDiscoveryIpFinderAdapter
ServiceDiscovery
recipe, which makes use of ephemeral nodes in ZK to register services.
There are several ways to instantiate the TcpDiscoveryZookeeperIpFinder:
CuratorFramework
directly, in which case no ZK Connection String
is required.setZkConnectionString(String)
, and optionally
a RetryPolicy
through the setter. If the latter is not provided, a default
ExponentialBackoffRetry
policy is used, with a base sleep time of 1000ms and 10 retries.PROP_ZK_CONNECTION_STRING
. If this
property is set, it overrides the ZK Connection String passed in as a property, but it does not override
the CuratorFramework
if provided.BASE_PATH
and
SERVICE_NAME
are use respectively. You can also choose to enable or disable duplicate registrations. See
setAllowDuplicateRegistrations(boolean)
for more details.Modifier and Type | Field and Description |
---|---|
static String |
PROP_ZK_CONNECTION_STRING
System property name to provide the ZK Connection String.
|
ignite
Constructor and Description |
---|
TcpDiscoveryZookeeperIpFinder()
Constructor.
|
close, discoveryClientMode, initializeLocalAddresses, isShared, onSpiContextInitialized, spiContext, toString
public static final String PROP_ZK_CONNECTION_STRING
public TcpDiscoveryZookeeperIpFinder()
public void onSpiContextDestroyed()
onSpiContextDestroyed
in interface TcpDiscoveryIpFinder
onSpiContextDestroyed
in class TcpDiscoveryIpFinderAdapter
public Collection<InetSocketAddress> getRegisteredAddresses() throws IgniteSpiException
null
.IgniteSpiException
- In case of error.public void registerAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException
Implementation should accept duplicates quietly, but should not register address if it is already registered.
addrs
- Addresses to register. Not null
and not empty.IgniteSpiException
- In case of error.public void unregisterAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException
Implementation should accept addresses that are currently not registered quietly (just no-op).
addrs
- Addresses to unregister. Not null
and not empty.IgniteSpiException
- In case of error.public TcpDiscoveryZookeeperIpFinder setCurator(org.apache.curator.framework.CuratorFramework curator)
curator
- A CuratorFramework
instance to use. It can already be in STARTED state.this
for chaining.public String getZkConnectionString()
public TcpDiscoveryZookeeperIpFinder setZkConnectionString(String zkConnectionString)
zkConnectionString
- ZooKeeper connection string in case a CuratorFramework
is not being set
explicitly.this
for chaining.public org.apache.curator.RetryPolicy getRetryPolicy()
public TcpDiscoveryZookeeperIpFinder setRetryPolicy(org.apache.curator.RetryPolicy retryPolicy)
retryPolicy
- RetryPolicy
to use in case a ZK Connection String is being injected, or if using a
system property.this
for chaining.public String getBasePath()
BASE_PATH
.public TcpDiscoveryZookeeperIpFinder setBasePath(String basePath)
basePath
- Base path for service registration in ZK. If not passed, BASE_PATH
will be used.this
for chaining.public String getServiceName()
setServiceName(String)
for more information.public TcpDiscoveryZookeeperIpFinder setServiceName(String serviceName)
serviceName
- Service name to use, as defined by Curator's {#link ServiceDiscovery} recipe. In physical ZK
terms, it represents the node under basePath
, under which services will be registered.this
for chaining.public boolean isAllowDuplicateRegistrations()
setAllowDuplicateRegistrations(boolean)
for more details.public TcpDiscoveryZookeeperIpFinder setAllowDuplicateRegistrations(boolean allowDuplicateRegistrations)
allowDuplicateRegistrations
- Whether to register each node only once, or if duplicate registrations are
allowed. Nodes will attempt to register themselves, plus those they know about. By default, duplicate
registrations are not allowed, but you might want to set this property to true if you have multiple
network interfaces or if you are facing troubles.this
for chaining.public TcpDiscoveryZookeeperIpFinder setShared(boolean shared)
true
then it is expected that IP addresses registered
with IP finder will be seen by IP finders on all other nodes.setShared
in class TcpDiscoveryIpFinderAdapter
shared
- true
if this IP finder is shared.this
for chaining.
GridGain In-Memory Computing Platform : ver. 8.9.15 Release Date : December 3 2024