public class GridTcpDiscoveryNodesRing extends Object
GridTcpDiscoverySpi| Constructor and Description |
|---|
GridTcpDiscoveryNodesRing() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(GridTcpDiscoveryNode node)
Adds node to topology, also initializes node last update time with current
system time.
|
Collection<GridTcpDiscoveryNode> |
allNodes()
Gets all nodes in the topology.
|
void |
clear()
Removes all remote nodes, leaves only local node.
|
GridTcpDiscoveryNode |
coordinator()
Finds coordinator in the topology.
|
GridTcpDiscoveryNode |
coordinator(Collection<GridTcpDiscoveryNode> excluded)
Finds coordinator in the topology filtering excluded nodes from the search.
|
boolean |
hasRemoteNodes()
Checks whether the topology has remote nodes in.
|
long |
incrementTopologyVersion()
Increments topology version and gets new value.
|
void |
localNode(GridTcpDiscoveryNode locNode)
Sets local node.
|
GridTcpDiscoveryNode |
nextNode()
Finds next node in the topology.
|
GridTcpDiscoveryNode |
nextNode(Collection<GridTcpDiscoveryNode> excluded)
Finds next node in the topology filtering excluded nodes from search.
|
long |
nextNodeOrder()
Increments topology version and gets new value.
|
GridTcpDiscoveryNode |
node(UUID nodeId)
Finds node by ID.
|
GridTcpDiscoveryNode |
previousNode()
Finds previous node in the topology.
|
GridTcpDiscoveryNode |
previousNode(Collection<GridTcpDiscoveryNode> excluded)
Finds previous node in the topology filtering excluded nodes from search.
|
Collection<GridTcpDiscoveryNode> |
remoteNodes()
Gets remote nodes.
|
GridTcpDiscoveryNode |
removeNode(UUID nodeId)
Removes node from the topology.
|
Collection<GridTcpDiscoveryNode> |
removeNodes(Collection<UUID> nodeIds)
Removes nodes from the topology.
|
void |
restoreTopology(Iterable<GridTcpDiscoveryNode> nodes,
long topVer)
Restores topology from parameters values.
|
long |
topologyVersion()
Gets current topology version.
|
boolean |
topologyVersion(long topVer)
Sets new topology version.
|
String |
toString() |
public void localNode(GridTcpDiscoveryNode locNode)
locNode - Local node.public Collection<GridTcpDiscoveryNode> allNodes()
public Collection<GridTcpDiscoveryNode> remoteNodes()
public boolean hasRemoteNodes()
true if the topology has remote nodes in.public boolean add(GridTcpDiscoveryNode node)
node - Node to add.true if such node was added and did not present previously in the topology.public void restoreTopology(Iterable<GridTcpDiscoveryNode> nodes, long topVer)
This method is called when new node receives topology from coordinator. In this case all nodes received are remote for local.
Also initializes nodes last update time with current system time.
nodes - List of remote nodes.topVer - Topology version.@Nullable public GridTcpDiscoveryNode node(UUID nodeId)
nodeId - Node id to find.null if not found.@Nullable public GridTcpDiscoveryNode removeNode(UUID nodeId)
nodeId - ID of the node to remove.true if node was removed.public Collection<GridTcpDiscoveryNode> removeNodes(Collection<UUID> nodeIds)
nodeIds - IDs of the nodes to remove.public void clear()
This should be called when SPI should be disconnected from topology and reconnected back after.
@Nullable public GridTcpDiscoveryNode coordinator()
@Nullable public GridTcpDiscoveryNode coordinator(@Nullable Collection<GridTcpDiscoveryNode> excluded)
This may be used when handling current coordinator leave or failure.
excluded - Nodes to exclude from the search (optional).null if all nodes are excluded.@Nullable public GridTcpDiscoveryNode nextNode()
@Nullable public GridTcpDiscoveryNode nextNode(@Nullable Collection<GridTcpDiscoveryNode> excluded)
This may be used when detecting and handling nodes failure.
excluded - Nodes to exclude from the search (optional). If provided,
cannot contain local node.null if all nodes were filtered out or
topology contains less than two nodes.@Nullable public GridTcpDiscoveryNode previousNode()
@Nullable public GridTcpDiscoveryNode previousNode(@Nullable Collection<GridTcpDiscoveryNode> excluded)
excluded - Nodes to exclude from the search (optional). If provided,
cannot contain local node.null if all nodes were filtered out or
topology contains less than two nodes.public long topologyVersion()
public boolean topologyVersion(long topVer)
topVer - New topology version (should be greater than current, otherwise no-op).True if topology has been changed.public long incrementTopologyVersion()
public long nextNodeOrder()
Copyright © 2014. All rights reserved.