Package org.apache.ignite.client

## Interface ClientClusterGroup

- All Known Subinterfaces:
    `ClientCluster`

      public interface ClientClusterGroup

  Thin client cluster group facade. Defines a cluster group which contains all or a subset of cluster nodes.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ClientClusterGroup` | `forAttribute​(String name, @Nullable Object val)` | Creates a new cluster group for nodes containing given name and value specified in user attributes.
    `ClientClusterGroup` | `forClients()` | Creates a cluster group of nodes started in client mode.
    `ClientClusterGroup` | `forHost​(String host, String... hosts)` | Gets cluster group consisting from the nodes running on the hosts specified.
    `ClientClusterGroup` | `forHost​(ClusterNode node)` | Gets cluster group consisting from the nodes in this cluster group residing on the same host (with the same MAC address) as the given node.
    `ClientClusterGroup` | `forNode​(ClusterNode node, ClusterNode... nodes)` | Creates a cluster group for the given node.
    `ClientClusterGroup` | `forNodeId​(UUID id, UUID... ids)` | Creates a cluster group for a node with the specified ID.
    `ClientClusterGroup` | `forNodeIds​(Collection<UUID> ids)` | Creates a cluster group over nodes with specified node IDs.
    `ClientClusterGroup` | `forNodes​(Collection<? extends ClusterNode> nodes)` | Creates a cluster group over a given set of nodes.
    `ClientClusterGroup` | `forOldest()` | Creates a cluster group with one oldest node from the current cluster group.
    `ClientClusterGroup` | `forOthers​(ClientClusterGroup prj)` | Creates a cluster group for nodes not included into the given cluster group.
    `ClientClusterGroup` | `forOthers​(ClusterNode node, ClusterNode... nodes)` | Creates a cluster group for nodes other than the given nodes.
    `ClientClusterGroup` | `forPredicate​(Predicate<ClusterNode> p)` | Creates a new cluster group which includes all nodes that pass the given predicate filter.
    `ClientClusterGroup` | `forRandom()` | Creates a cluster group with one random node from the current cluster group.
    `ClientClusterGroup` | `forServers()` | Creates a cluster group of nodes started in server mode.
    `ClientClusterGroup` | `forYoungest()` | Creates a cluster group with one youngest node in the current cluster group.
    `ClusterNode` | `node()` | Gets first node from the list of nodes in this cluster group.
    `ClusterNode` | `node​(UUID nid)` | Gets a node for given ID from this cluster group.
    `Collection<ClusterNode>` | `nodes()` | Gets the read-only collection of nodes in this cluster group.

- - ### Method Detail

    - #### forNodes

          ClientClusterGroup forNodes​(Collection<? extends ClusterNode> nodes)

      Creates a cluster group over a given set of nodes.
      Parameters:
        `nodes` - Collection of nodes to create the cluster group from.
      Returns:
        Cluster group for the provided grid nodes.

    - #### forNode

          ClientClusterGroup forNode​(ClusterNode node,
                                     ClusterNode... nodes)

      Creates a cluster group for the given node.
      Parameters:
        `node` - Node to create cluster group for.
        `nodes` - Optional additional nodes to include into the cluster group.
      Returns:
        Cluster group for the given nodes.

    - #### forOthers

          ClientClusterGroup forOthers​(ClusterNode node,
                                       ClusterNode... nodes)

      Creates a cluster group for nodes other than the given nodes.
      Parameters:
        `node` - Node to exclude from the new cluster group.
        `nodes` - Optional additional nodes to exclude from the cluster group.
      Returns:
        Cluster group that will contain all nodes from the original cluster group excluding the given nodes.

    - #### forOthers

          ClientClusterGroup forOthers​(ClientClusterGroup prj)

      Creates a cluster group for nodes not included into the given cluster group.
      Parameters:
        `prj` - Cluster group to exclude from the new cluster group.
      Returns:
        Cluster group for nodes not included into the given cluster group.

    - #### forNodeIds

          ClientClusterGroup forNodeIds​(Collection<UUID> ids)

      Creates a cluster group over nodes with specified node IDs.
      Parameters:
        `ids` - Collection of node IDs.
      Returns:
        Cluster group over nodes with the specified node IDs.

    - #### forNodeId

          ClientClusterGroup forNodeId​(UUID id,
                                       UUID... ids)

      Creates a cluster group for a node with the specified ID.
      Parameters:
        `id` - Node ID to get the cluster group for.
        `ids` - Optional additional node IDs to include into the cluster group.
      Returns:
        Cluster group over the node with the specified node IDs.

    - #### forPredicate

          ClientClusterGroup forPredicate​(Predicate<ClusterNode> p)

      Creates a new cluster group which includes all nodes that pass the given predicate filter.
      Parameters:
        `p` - Predicate filter for nodes to include into the cluster group.
      Returns:
        Cluster group for nodes that passed the predicate filter.

    - #### forAttribute

          ClientClusterGroup forAttribute​(String name,
                                          @Nullable
                                          @Nullable Object val)

      Creates a new cluster group for nodes containing given name and value specified in user attributes.

      User attributes for every node are optional and can be specified in grid node configuration. See `IgniteConfiguration.getUserAttributes()` for more information.

      Parameters:
        `name` - Name of the attribute.
        `val` - Optional attribute value to match (if null, just check if attribute exists).
      Returns:
        Cluster group for nodes containing specified attribute.

    - #### forServers

          ClientClusterGroup forServers()

      Creates a cluster group of nodes started in server mode.
      Returns:
        Cluster group of nodes started in server mode.
      See Also:
        `Ignition.setClientMode(boolean)`, `IgniteConfiguration.setClientMode(boolean)`

    - #### forClients

          ClientClusterGroup forClients()

      Creates a cluster group of nodes started in client mode.
      Returns:
        Cluster group of nodes started in client mode.
      See Also:
        `Ignition.setClientMode(boolean)`, `IgniteConfiguration.setClientMode(boolean)`

    - #### forRandom

          ClientClusterGroup forRandom()

      Creates a cluster group with one random node from the current cluster group.
      Returns:
        Cluster group containing one random node from the current cluster group.

    - #### forOldest

          ClientClusterGroup forOldest()

      Creates a cluster group with one oldest node from the current cluster group. The resulting cluster group is dynamic and will always pick the next oldest node if the previous one leaves topology even after the cluster group has been created.

      Use `node()` method to get the oldest node.

      Returns:
        Cluster group containing one oldest node from the current cluster group.

    - #### forYoungest

          ClientClusterGroup forYoungest()

      Creates a cluster group with one youngest node in the current cluster group. The resulting cluster group is dynamic and will always pick the newest node in the topology, even if more nodes entered after the cluster group has been created.
      Returns:
        Cluster group containing one youngest node from the current cluster group.

    - #### forHost

          ClientClusterGroup forHost​(ClusterNode node)

      Gets cluster group consisting from the nodes in this cluster group residing on the same host (with the same MAC address) as the given node.
      Parameters:
        `node` - Node to select the host for.
      Returns:
        Cluster group for nodes residing on the same host as the specified node.

    - #### forHost

          ClientClusterGroup forHost​(String host,
                                     String... hosts)

      Gets cluster group consisting from the nodes running on the hosts specified.
      Parameters:
        `host` - Host name to get nodes to put in cluster
        `hosts` - Host names to get nodes to put in cluster.
      Returns:
        Cluster group for nodes residing on the hosts specified.

    - #### nodes

          Collection<ClusterNode> nodes()

      Gets the read-only collection of nodes in this cluster group.
      Returns:
        All nodes in this cluster group.

    - #### node

          ClusterNode node​(UUID nid)

      Gets a node for given ID from this cluster group.
      Parameters:
        `nid` - Node ID.
      Returns:
        Node with given ID from this cluster group or `null`, if such node does not exist.

    - #### node

          ClusterNode node()

      Gets first node from the list of nodes in this cluster group. This method is specifically useful for cluster groups with one node only.
      Returns:
        First node from the list of nodes in this cluster group or `null` if the cluster group is empty.