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 Description GridClientTopology(GridClientConfiguration cfg)Creates topology instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTopologyListener(GridClientTopologyListener lsnr)Adds topology listener.voidfail(GridClientException cause)Marks topology as failed.booleanfailed()@Nullable GridClientExceptionlastError()GridClientNodenode(UUID id)Gets node from last saved topology snapshot by it's id.voidnodeFailed(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.voidremoveTopologyListener(GridClientTopologyListener lsnr)Removes topology listener.voidshutdown()Shutdowns executor service that performs listener notification.Collection<GridClientTopologyListener>topologyListeners()Returns all added topology listeners.GridClientNodeupdateNode(GridClientNodeImpl node)Updates topology if cache enabled.Collection<? extends GridClientNode>updateTopology(Collection<GridClientNodeImpl> nodeList)Updates (if cache is enabled) the whole topology.
-
-
-
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
nullif 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.
-
lastError
@Nullable public @Nullable GridClientException lastError()
-
failed
public boolean failed()
- Returns:
- Whether topology is failed.
-
shutdown
public void shutdown()
Shutdowns executor service that performs listener notification.
-
-