Class TcpDiscoverySharedFsIpFinder
- java.lang.Object
-
- org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter
-
- org.apache.ignite.spi.discovery.tcp.ipfinder.sharedfs.TcpDiscoverySharedFsIpFinder
-
- All Implemented Interfaces:
TcpDiscoveryIpFinder
public class TcpDiscoverySharedFsIpFinder extends TcpDiscoveryIpFinderAdapter
Shared filesystem-based IP finder.Configuration
Mandatory
There are no mandatory configuration parameters.Optional
- Path (see
setPath(String)) - Shared flag (see
setShared(boolean))
If
getPath()is not provided, thenDFLT_PATHwill be used and only local nodes will discover each other. To enable discovery over network you must provide a path to a shared directory explicitly.The directory will contain empty files named like the following 192.168.1.136#1001.
Note that this finder is shared by default (see
TcpDiscoveryIpFinder.isShared().
-
-
Field Summary
Fields Modifier and Type Field Description static StringDELIMDelimiter to use between address and port tokens in file names.static StringDFLT_PATHDefault path for discovering of local nodes (testing only).-
Fields inherited from class org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter
ignite
-
-
Constructor Summary
Constructors Constructor Description TcpDiscoverySharedFsIpFinder()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetPath()Gets path.Collection<InetSocketAddress>getRegisteredAddresses()Gets all addresses registered in this finder.voidregisterAddresses(Collection<InetSocketAddress> addrs)Registers new addresses.TcpDiscoverySharedFsIpFindersetPath(String path)Sets path.TcpDiscoverySharedFsIpFindersetShared(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
-
-
-
-
Field Detail
-
DFLT_PATH
public static final String DFLT_PATH
Default path for discovering of local nodes (testing only). Note that this path is relative toIGNITE_HOME/workfolder ifIGNITE_HOMEsystem or environment variable specified, otherwise it is relative toworkfolder under systemjava.io.tmpdirfolder.
-
DELIM
public static final String DELIM
Delimiter to use between address and port tokens in file names.- See Also:
- Constant Field Values
-
-
Method Detail
-
getPath
public String getPath()
Gets path.- Returns:
- Shared path.
-
setPath
@IgniteSpiConfiguration(optional=true) public TcpDiscoverySharedFsIpFinder setPath(String path)
Sets path.- Parameters:
path- Shared path.- Returns:
thisfor chaining.
-
getRegisteredAddresses
public Collection<InetSocketAddress> getRegisteredAddresses() throws IgniteSpiException
Gets all addresses registered in this finder.- Returns:
- All known addresses, potentially empty, but never
null. - Throws:
IgniteSpiException- In case of error.
-
registerAddresses
public void registerAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException
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.- Throws:
IgniteSpiException- In case of error.
-
unregisterAddresses
public void unregisterAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException
Unregisters provided addresses.Implementation should accept addresses that are currently not registered quietly (just no-op).
- Parameters:
addrs- Addresses to unregister. Notnulland not empty.- Throws:
IgniteSpiException- In case of error.
-
setShared
public TcpDiscoverySharedFsIpFinder 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
-
-