Class TcpDiscoveryIpFinderAdapter
- java.lang.Object
-
- org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter
-
- All Implemented Interfaces:
TcpDiscoveryIpFinder
- Direct Known Subclasses:
TcpDiscoveryJdbcIpFinder,TcpDiscoveryKubernetesIpFinder,TcpDiscoverySharedFsIpFinder,TcpDiscoveryVmIpFinder
public abstract class TcpDiscoveryIpFinderAdapter extends Object implements TcpDiscoveryIpFinder
IP finder interface implementation adapter.
-
-
Constructor Summary
Constructors Constructor Description TcpDiscoveryIpFinderAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Closes this IP finder and releases any system resources associated with it.protected booleandiscoveryClientMode()Deprecated.Since 2.8.voidinitializeLocalAddresses(Collection<InetSocketAddress> addrs)Initializes addresses discovery SPI binds to.booleanisShared()Checks whether IP finder is shared or not.voidonSpiContextDestroyed()Callback invoked prior to stopping grid before SPI context is destroyed.voidonSpiContextInitialized(IgniteSpiContext spiCtx)Callback invoked when SPI context is initialized afterTcpDiscoverySpi.spiStart(String)method is completed, SPI context can be stored for future access.TcpDiscoveryIpFinderAdaptersetShared(boolean shared)Sets shared flag.protected IgniteSpiContextspiContext()StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder
getRegisteredAddresses, registerAddresses, unregisterAddresses
-
-
-
-
Field Detail
-
ignite
@Deprecated @IgniteInstanceResource @GridToStringExclude protected Ignite ignite
Deprecated.Since 2.8. May contain an invalid Ignite instance when multiple nodes shares sameTcpDiscoveryIpFinderinstance.Ignite instance.
-
-
Method Detail
-
onSpiContextInitialized
public void onSpiContextInitialized(IgniteSpiContext spiCtx) throws IgniteSpiException
Callback invoked when SPI context is initialized afterTcpDiscoverySpi.spiStart(String)method is completed, SPI context can be stored for future access.- Specified by:
onSpiContextInitializedin interfaceTcpDiscoveryIpFinder- Parameters:
spiCtx- Spi context.- Throws:
IgniteSpiException- In case of error.
-
onSpiContextDestroyed
public void onSpiContextDestroyed()
Callback invoked prior to stopping grid before SPI context is destroyed. Note that invoking SPI context after this callback is complete is considered illegal and may produce unknown results.- Specified by:
onSpiContextDestroyedin interfaceTcpDiscoveryIpFinder
-
initializeLocalAddresses
public void initializeLocalAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException
Initializes addresses discovery SPI binds to.- Specified by:
initializeLocalAddressesin interfaceTcpDiscoveryIpFinder- Parameters:
addrs- Addresses discovery SPI binds to.- Throws:
IgniteSpiException- In case of error.
-
isShared
public boolean isShared()
Checks whether IP finder is shared or not.If this property is set to
truethen IP finder allows to add and remove addresses in runtime and this is how, for example, IP finder should work in Amazon EC2 environment or any other environment where IPs may not be known beforehand.If this property is set to
falsethen IP finder is immutable and all the addresses should be listed in configuration before Ignite start. This is the most use case for IP finders local to current VM. Since, usually such IP finders are created per each Ignite instance and all the known IPs are listed right away, but there is also an option to make such IP finders shared by setting this property totrueand literally share it between local VM Ignite instances. This way user does not have to list any IPs before start, instead all starting nodes add their addresses to the finder, then get the registered addresses and continue with discovery procedure.- Specified by:
isSharedin interfaceTcpDiscoveryIpFinder- Returns:
trueif IP finder is shared.
-
setShared
@IgniteSpiConfiguration(optional=true) public TcpDiscoveryIpFinderAdapter setShared(boolean shared)
Sets shared flag. Iftruethen it is expected that IP addresses registered with IP finder will be seen by IP finders on all other nodes.- Parameters:
shared-trueif this IP finder is shared.- Returns:
thisfor chaining.
-
close
public void close()
Closes this IP finder and releases any system resources associated with it.- Specified by:
closein interfaceTcpDiscoveryIpFinder
-
discoveryClientMode
@Deprecated protected boolean discoveryClientMode()
Deprecated.Since 2.8. May return incorrect value if client and server nodes shares sameTcpDiscoveryIpFinderinstance.- Returns:
Trueif TCP discovery works in client mode.
-
spiContext
protected IgniteSpiContext spiContext()
- Returns:
- SPI context.
-
-