Class TcpDiscoveryVmIpFinder
- java.lang.Object
-
- org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter
-
- org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder
-
- All Implemented Interfaces:
TcpDiscoveryIpFinder
- Direct Known Subclasses:
TcpDiscoveryMulticastIpFinder
public class TcpDiscoveryVmIpFinder extends TcpDiscoveryIpFinderAdapter
IP Finder which works only with pre-configured list of IP addresses specified viasetAddresses(Collection)method. By default, this IP finder is notshared, which means that all grid nodes have to be configured with the same list of IP addresses when this IP finder is used.Configuration
Mandatory
There are no mandatory configuration parameters.Optional
- Addresses for initialization (see
setAddresses(Collection)) - Shared flag (see
setShared(boolean))
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter
ignite
-
-
Constructor Summary
Constructors Constructor Description TcpDiscoveryVmIpFinder()Constructs new IP finder.TcpDiscoveryVmIpFinder(boolean shared)Constructs new IP finder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<InetSocketAddress>getRegisteredAddresses()Gets all addresses registered in this finder.voidregisterAddresses(Collection<InetSocketAddress> addrs)Registers new addresses.TcpDiscoveryVmIpFindersetAddresses(Collection<String> addrs)Parses provided values and initializes the internal collection of addresses.TcpDiscoveryVmIpFindersetShared(boolean shared)Sets shared flag.StringtoString()voidunregisterAddresses(Collection<InetSocketAddress> addrs)Unregisters provided addresses.-
Methods inherited from class org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter
close, discoveryClientMode, initializeLocalAddresses, isShared, onSpiContextDestroyed, onSpiContextInitialized, spiContext
-
-
-
-
Constructor Detail
-
TcpDiscoveryVmIpFinder
public TcpDiscoveryVmIpFinder()
Constructs new IP finder.
-
TcpDiscoveryVmIpFinder
public TcpDiscoveryVmIpFinder(boolean shared)
Constructs new IP finder.- Parameters:
shared-trueif IP finder is shared.- See Also:
setShared(boolean)
-
-
Method Detail
-
setAddresses
@IgniteSpiConfiguration(optional=true) public TcpDiscoveryVmIpFinder setAddresses(Collection<String> addrs) throws IgniteSpiException
Parses provided values and initializes the internal collection of addresses.Addresses may be represented as follows:
- IP address (e.g. 127.0.0.1, 9.9.9.9, etc);
- IP address and port (e.g. 127.0.0.1:47500, 9.9.9.9:47501, etc);
- IP address and port range (e.g. 127.0.0.1:47500..47510, 9.9.9.9:47501..47504, etc);
- Hostname (e.g. host1.com, host2, etc);
- Hostname and port (e.g. host1.com:47500, host2:47502, etc).
- Hostname and port range (e.g. host1.com:47500..47510, host2:47502..47508, etc).
If port is 0 or not provided then default port will be used (depends on discovery SPI configuration).
If port range is provided (e.g. host:port1..port2) the following should be considered:
port1 < port2should betrue;- Both
port1andport2should be greater than0.
- Parameters:
addrs- Known nodes addresses.- Returns:
thisfor chaining.- Throws:
IgniteSpiException- If any error occurs.
-
getRegisteredAddresses
public Collection<InetSocketAddress> getRegisteredAddresses()
Gets all addresses registered in this finder.- Returns:
- All known addresses, potentially empty, but never
null.
-
registerAddresses
public void registerAddresses(Collection<InetSocketAddress> addrs)
Registers new addresses.Implementation should accept duplicates quietly, but should not register address if it is already registered.
- Parameters:
addrs- Addresses to register. Notnulland not empty.
-
unregisterAddresses
public void unregisterAddresses(Collection<InetSocketAddress> addrs)
Unregisters provided addresses.Implementation should accept addresses that are currently not registered quietly (just no-op).
- Parameters:
addrs- Addresses to unregister. Notnulland not empty.
-
setShared
public TcpDiscoveryVmIpFinder 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.- Overrides:
setSharedin classTcpDiscoveryIpFinderAdapter- Parameters:
shared-trueif this IP finder is shared.- Returns:
thisfor chaining.
-
toString
public String toString()
- Overrides:
toStringin classTcpDiscoveryIpFinderAdapter
-
-