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

## Class TcpDiscoveryVmIpFinder

- java.lang.Object
- - org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter
  - - org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder

- All Implemented Interfaces:
    TcpDiscoveryIpFinder
  Direct Known Subclasses:
    TcpDiscoveryMulticastIpFinder

      public class TcpDiscoveryVmIpFinder
      extends TcpDiscoveryIpFinderAdapter

  IP Finder which works only with pre-configured list of IP addresses specified via `setAddresses(Collection)` method. By default, this IP finder is not `shared`, which means that all grid nodes have to be configured with the same list of IP addresses when this IP finder is used.

  # Configuration

  ## Mandatory

  There are no mandatory configuration parameters.

  ## Optional

  - Addresses for initialization (see `setAddresses(Collection)`)
  - Shared flag (see `setShared(boolean)`)

- - ### Field Summary

    - ### Fields inherited from class org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter

      `ignite`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TcpDiscoveryVmIpFinder()` Constructs new IP finder.
    `TcpDiscoveryVmIpFinder(boolean shared)` Constructs new IP finder.

  - ### 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.
    `TcpDiscoveryVmIpFinder` | `setAddresses(Collection<String> addrs)` Parses provided values and initializes the internal collection of addresses.
    `TcpDiscoveryVmIpFinder` | `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

    - #### TcpDiscoveryVmIpFinder

          public TcpDiscoveryVmIpFinder()

      Constructs new IP finder.

    - #### TcpDiscoveryVmIpFinder

          public TcpDiscoveryVmIpFinder(boolean shared)

      Constructs new IP finder.
      Parameters:
        `shared` - `true` if IP finder is shared.
      See Also:
        `setShared(boolean)`

  - ### Method Detail

    - #### setAddresses

          @IgniteSpiConfiguration(optional=true)
          public TcpDiscoveryVmIpFinder setAddresses(Collection<String> addrs)
                                                                                     throws IgniteSpiException

      Parses provided values and initializes the internal collection of addresses.

      Addresses may be represented as follows:

      - IP address (e.g. 127.0.0.1, 9.9.9.9, etc);
      - IP address and port (e.g. 127.0.0.1:47500, 9.9.9.9:47501, etc);
      - IP address and port range (e.g. 127.0.0.1:47500..47510, 9.9.9.9:47501..47504, etc);
      - Hostname (e.g. host1.com, host2, etc);
      - Hostname and port (e.g. host1.com:47500, host2:47502, etc).
      - Hostname and port range (e.g. host1.com:47500..47510, host2:47502..47508, etc).

      If port is 0 or not provided then default port will be used (depends on discovery SPI configuration).

      If port range is provided (e.g. host:port1..port2) the following should be considered:

      - `port1 < port2` should be `true`;
      - Both `port1` and `port2` should be greater than `0`.
      Parameters:
        `addrs` - Known nodes addresses.
      Returns:
        `this` for chaining.
      Throws:
        `IgniteSpiException` - If any error occurs.

    - #### getRegisteredAddresses

          public Collection<InetSocketAddress> getRegisteredAddresses()

      Gets all addresses registered in this finder.
      Returns:
        All known addresses, potentially empty, but never `null`.

    - #### registerAddresses

          public void registerAddresses(Collection<InetSocketAddress> addrs)

      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.

    - #### unregisterAddresses

          public void unregisterAddresses(Collection<InetSocketAddress> addrs)

      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.

    - #### setShared

          public TcpDiscoveryVmIpFinder 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