org.apache.ignite.configuration

## Interface TopologyValidator

- All Superinterfaces:
    Serializable

      public interface TopologyValidator
      extends Serializable

  Topology validator is used to verify that cluster topology is valid for further cache operations. The topology validator is invoked every time the cluster topology changes (either a new node joined or an existing node failed or left).

  If topology validator is not configured, then the cluster topology is always considered to be valid.

  Whenever the `validate(Collection)` method returns `true`, then the topology is considered valid for a certain cache and all operations on this cache will be allowed to proceed. Otherwise, all update operations on the cache are restricted with the following exceptions:

  - `CacheException` will be thrown for all update operations (put, remove, etc) attempt.
  - `IgniteException` will be thrown for the transaction commit attempt.
  After returning `false` and declaring the topology not valid, the topology validator can return to normal state whenever the next topology change happens.

  # Example

  The example below shows how a validator can be used to allow cache updates only in case if the cluster topology contains exactly 2 nodes:

       new TopologyValidator() {
          public boolean validate(Collection nodes) {
             return nodes.size() == 2;
          }
       }

  # Configuration

  The topology validator can be configured either from code or XML via `CacheConfiguration.setTopologyValidator(TopologyValidator)` method.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `validate(Collection<ClusterNode> nodes)` Validates topology.

- - ### Method Detail

    - #### validate

          boolean validate(Collection<ClusterNode> nodes)

      Validates topology.
      Parameters:
        `nodes` - Collection of nodes.
      Returns:
        `true` in case topology is valid for specific cache, otherwise `false`

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