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_PATH
will 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 String
DELIM
Delimiter to use between address and port tokens in file names.static String
DFLT_PATH
Default 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 String
getPath()
Gets path.Collection<InetSocketAddress>
getRegisteredAddresses()
Gets all addresses registered in this finder.void
registerAddresses(Collection<InetSocketAddress> addrs)
Registers new addresses.TcpDiscoverySharedFsIpFinder
setPath(String path)
Sets path.TcpDiscoverySharedFsIpFinder
setShared(boolean shared)
Sets shared flag.String
toString()
void
unregisterAddresses(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/work
folder ifIGNITE_HOME
system or environment variable specified, otherwise it is relative towork
folder under systemjava.io.tmpdir
folder.
-
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:
this
for 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. Notnull
and 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. Notnull
and not empty.- Throws:
IgniteSpiException
- In case of error.
-
setShared
public TcpDiscoverySharedFsIpFinder setShared(boolean shared)
Sets shared flag. Iftrue
then it is expected that IP addresses registered with IP finder will be seen by IP finders on all other nodes.- Overrides:
setShared
in classTcpDiscoveryIpFinderAdapter
- Parameters:
shared
-true
if this IP finder is shared.- Returns:
this
for chaining.
-
toString
public String toString()
- Overrides:
toString
in classTcpDiscoveryIpFinderAdapter
-
-