org.apache.ignite.internal.client.impl.connection

## Class GridClientTopology

- java.lang.Object
- - org.apache.ignite.internal.client.impl.connection.GridClientTopology

    public class GridClientTopology
    extends Object

Client topology cache.

### Constructor Summary

Constructors
Constructor and Description
`GridClientTopology(GridClientConfiguration cfg)` Creates topology instance.

### Method Summary

Methods
`void` `addTopologyListener(GridClientTopologyListener lsnr)` Adds topology listener.
`void` `fail(GridClientException cause)` Marks topology as failed.
`boolean` `failed()`
`GridClientNode` `node(UUID id)` Gets node from last saved topology snapshot by it's id.
`void` `nodeFailed(UUID nodeId)` Updates topology when node that is expected to be in topology fails.
`Collection<GridClientNodeImpl>` `nodes()` Gets full topology snapshot.
`Collection<GridClientNode>` `nodes(Iterable<UUID> ids)` Gets a collection of nodes from last saved topology snapshot by their ids.
`void` `removeTopologyListener(GridClientTopologyListener lsnr)` Removes topology listener.
`void` `shutdown()` Shutdowns executor service that performs listener notification.
`Collection<GridClientTopologyListener>` `topologyListeners()` Returns all added topology listeners.
`GridClientNode` `updateNode(GridClientNodeImpl node)` Updates topology if cache enabled.
`Collection<? extends GridClientNode>` `updateTopology(Collection<GridClientNodeImpl> nodeList)` Updates (if cache is enabled) the whole topology.

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

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

### Constructor Detail

#### GridClientTopology

    public GridClientTopology(GridClientConfiguration cfg)

Creates topology instance.

Parameters:
  `cfg` - Client configuration.

### Method Detail

#### addTopologyListener

    public void addTopologyListener(GridClientTopologyListener lsnr)

Adds topology listener.

Parameters:
  `lsnr` - Topology listener.

#### removeTopologyListener

    public void removeTopologyListener(GridClientTopologyListener lsnr)

Removes topology listener.

Parameters:
  `lsnr` - Topology listener.

#### topologyListeners

    public Collection<GridClientTopologyListener> topologyListeners()

Returns all added topology listeners.

Returns:
  Unmodifiable view of topology listeners.

#### updateNode

    public GridClientNode updateNode(GridClientNodeImpl node)

Updates topology if cache enabled. If cache is disabled, returns original node.

Parameters:
  `node` - Converted rest server response.
Returns:
  Node in topology.

#### updateTopology

    public Collection<? extends GridClientNode> updateTopology(Collection<GridClientNodeImpl> nodeList)

Updates (if cache is enabled) the whole topology. If cache is disabled, original collection is returned.

Parameters:
  `nodeList` - Converted rest server response.
Returns:
  Topology nodes.

#### fail

    public void fail(GridClientException cause)

Marks topology as failed. After this method called all accessors will throw exception until a next successful update.

Parameters:
  `cause` - Exception caused the failure.

#### nodeFailed

    public void nodeFailed(UUID nodeId)

Updates topology when node that is expected to be in topology fails.

Parameters:
  `nodeId` - Node id for which node failed to be obtained.

#### node

    public GridClientNode node(UUID id)
                        throws GridClientException

Gets node from last saved topology snapshot by it's id.

Parameters:
  `id` - Node id.
Returns:
  Node or `null` if node was not found.
Throws:
  `GridClientException` - If topology is failed and no nodes available.

#### nodes

    public Collection<GridClientNode> nodes(Iterable<UUID> ids)
                                     throws GridClientException

Gets a collection of nodes from last saved topology snapshot by their ids.

Parameters:
  `ids` - Collection of ids for which nodes should be retrieved..
Returns:
  Collection of nodes that are in topology.
Throws:
  `GridClientException` - If topology is failed and no nodes available.

#### nodes

    public Collection<GridClientNodeImpl> nodes()
                                         throws GridClientException

Gets full topology snapshot.

Returns:
  Collection of nodes that were in last captured topology snapshot.
Throws:
  `GridClientException` - If topology is failed and no nodes available.

#### failed

    public boolean failed()

Returns:
  Whether topology is failed.

#### shutdown

    public void shutdown()

Shutdowns executor service that performs listener notification.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.7.0
Release Date | : August 1 2016