org.apache.ignite.spi.discovery.tcp.ipfinder.jdbc

## 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 and Description
`TcpDiscoveryJdbcIpFinder()` Constructor.
`TcpDiscoveryJdbcIpFinder(JdbcIpFinderDialect jdbcDialect)`

### Method Summary

Methods
`Collection<InetSocketAddress>` `getRegisteredAddresses()` Gets all addresses registered in this finder.
`void` `registerAddresses(Collection<InetSocketAddress> addrs)` Registers new addresses.
`void` `setDataSource(DataSource dataSrc)` Sets data source.
`void` `setInitSchema(boolean initSchema)` Flag indicating whether DB schema should be initialized by Ignite (default behaviour) or was explicitly created by user.
`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, setShared, spiContext`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### TcpDiscoveryJdbcIpFinder

    public TcpDiscoveryJdbcIpFinder()

Constructor.

#### TcpDiscoveryJdbcIpFinder

    public TcpDiscoveryJdbcIpFinder(JdbcIpFinderDialect jdbcDialect)

### 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. Not `null` 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. Not `null` and not empty.
Throws:
  `IgniteSpiException` - In case of error.

#### setDataSource

    @IgniteSpiConfiguration(optional=false)
    public void setDataSource(DataSource dataSrc)

Sets data source.

Data source should be fully configured and ready-to-use.

Parameters:
  `dataSrc` - Data source.

#### setInitSchema

    @IgniteSpiConfiguration(optional=true)
    public void setInitSchema(boolean initSchema)

Flag indicating whether DB schema should be initialized by Ignite (default behaviour) or was explicitly created by user.

Parameters:
  `initSchema` - `True` if DB schema should be initialized by Ignite (default behaviour), {code @false} if schema was explicitly created by user.

#### toString

    public String toString()

Overrides:
  `toString` in class `TcpDiscoveryIpFinderAdapter`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.8.0
Release Date | : December 5 2016