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

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

    - ### 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 TcpDiscoveryJdbcIpFinder setDataSource(DataSource dataSrc)

      Sets data source.

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

      Parameters:
        `dataSrc` - Data source.
      Returns:
        `this` for 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` - `True` if DB schema should be initialized by Ignite (default behaviour), {code @false} if schema was explicitly created by user.
      Returns:
        `this` for chaining.

    - #### setShared

          public TcpDiscoveryJdbcIpFinder setShared(boolean shared)

      Sets shared flag. If `true` then it is expected that IP addresses registered with IP finder will be seen by IP finders on all other nodes.
      Overrides:
        `setShared` in class `TcpDiscoveryIpFinderAdapter`
      Parameters:
        `shared` - `true` if this IP finder is shared.
      Returns:
        `this` for chaining.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `TcpDiscoveryIpFinderAdapter`

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021