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

## 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, then `DFLT_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 and 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 and Description
    `TcpDiscoverySharedFsIpFinder()` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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`

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

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

- - ### 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 to `IGNITE_HOME/work` folder if `IGNITE_HOME` system or environment variable specified, otherwise it is relative to `work` folder under system `java.io.tmpdir` folder.
      See Also:
        `IgniteConfiguration.getWorkDirectory()`, Constant Field Values

    - #### DELIM

          public static final String DELIM

      Delimiter to use between address and port tokens in file names.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TcpDiscoverySharedFsIpFinder

          public TcpDiscoverySharedFsIpFinder()

      Constructor.

  - ### 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. 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.

    - #### setShared

          public TcpDiscoverySharedFsIpFinder 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`

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023