Class TcpDiscoveryJdbcIpFinder
- java.lang.Object
-
- org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter
-
- org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc.TcpDiscoveryJdbcIpFinder
-
- All Implemented Interfaces:
TcpDiscoveryIpFinder
public class TcpDiscoveryJdbcIpFinder extends TcpDiscoveryIpFinderAdapter
JDBC-based IP finder.Configuration
Mandatory
- Data source (see
setDataSource(DataSource)).
Optional
The following configuration parameters are optional:- Flag indicating whether DB schema should be initialized by Ignite (default behaviour) or
was explicitly created by user (see
setInitSchema(boolean))
The database will contain 1 table which will hold IP addresses.
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter
ignite
-
-
Constructor Summary
Constructors Constructor Description TcpDiscoveryJdbcIpFinder()Constructor.TcpDiscoveryJdbcIpFinder(JdbcIpFinderDialect jdbcDialect)
-
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.TcpDiscoveryJdbcIpFindersetDataSource(DataSource dataSrc)Sets data source.TcpDiscoveryJdbcIpFindersetInitSchema(boolean initSchema)Flag indicating whether DB schema should be initialized by Ignite (default behaviour) or was explicitly created by user.TcpDiscoveryJdbcIpFindersetShared(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
-
TcpDiscoveryJdbcIpFinder
public TcpDiscoveryJdbcIpFinder()
Constructor.
-
TcpDiscoveryJdbcIpFinder
public TcpDiscoveryJdbcIpFinder(JdbcIpFinderDialect jdbcDialect)
- Parameters:
jdbcDialect- SQL dialect to use withTcpDiscoveryJdbcIpFinder.
-
-
Method Detail
-
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.
-
setDataSource
@IgniteSpiConfiguration(optional=false) public TcpDiscoveryJdbcIpFinder setDataSource(DataSource dataSrc)
Sets data source.Data source should be fully configured and ready-to-use.
- Parameters:
dataSrc- Data source.- Returns:
thisfor chaining.
-
setInitSchema
@IgniteSpiConfiguration(optional=true) public TcpDiscoveryJdbcIpFinder setInitSchema(boolean initSchema)
Flag indicating whether DB schema should be initialized by Ignite (default behaviour) or was explicitly created by user.- Parameters:
initSchema-Trueif DB schema should be initialized by Ignite (default behaviour), {code @false} if schema was explicitly created by user.- Returns:
thisfor chaining.
-
setShared
public TcpDiscoveryJdbcIpFinder 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
-
-