Package org.apache.bookkeeper.net
Class StabilizeNetworkTopology
java.lang.Object
org.apache.bookkeeper.net.StabilizeNetworkTopology
- All Implemented Interfaces:
NetworkTopology
This is going to provide a stabilize network topology regarding to flapping zookeeper registration.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final NetworkTopologyImplprotected final ConcurrentMap<Node,StabilizeNetworkTopology.NodeStatus> protected final longprotected final io.netty.util.HashedWheelTimerFields inherited from interface org.apache.bookkeeper.net.NetworkTopology
DEFAULT_RACK, DEFAULT_REGION, DEFAULT_REGION_AND_RACK, DEFAULT_UPGRADEDOMAIN, DEFAULT_ZONE, DEFAULT_ZONE_AND_UPGRADEDOMAIN -
Constructor Summary
ConstructorsConstructorDescriptionStabilizeNetworkTopology(io.netty.util.HashedWheelTimer timer, int stabilizePeriodSeconds) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a node to the network topology.booleanCheck if the tree contains node node.intcountNumOfAvailableNodes(String scope, Collection<Node> excludedNodes) Return the number of leaves in scope but not in excludedNodes.Returns the nodes under a location.Retrieve a node from the network topology.intReturns number of racks in the network topology.voidRemove a node from network topology.(package private) voidupdateNode(Node node, boolean tentativeToRemove)
-
Field Details
-
impl
-
timer
protected final io.netty.util.HashedWheelTimer timer -
nodeStatuses
-
stabilizePeriodMillis
protected final long stabilizePeriodMillis
-
-
Constructor Details
-
StabilizeNetworkTopology
public StabilizeNetworkTopology(io.netty.util.HashedWheelTimer timer, int stabilizePeriodSeconds)
-
-
Method Details
-
updateNode
-
add
Description copied from interface:NetworkTopologyAdd a node to the network topology.- Specified by:
addin interfaceNetworkTopology- Parameters:
node- add the node to network topology
-
remove
Description copied from interface:NetworkTopologyRemove a node from network topology.- Specified by:
removein interfaceNetworkTopology- Parameters:
node- remove the node from network topology
-
contains
Description copied from interface:NetworkTopologyCheck if the tree contains node node.- Specified by:
containsin interfaceNetworkTopology- Parameters:
node- node to check- Returns:
- true if node is already in the network topology, otherwise false.
-
getNode
Description copied from interface:NetworkTopologyRetrieve a node from the network topology.- Specified by:
getNodein interfaceNetworkTopology- Returns:
-
getNumOfRacks
public int getNumOfRacks()Description copied from interface:NetworkTopologyReturns number of racks in the network topology.- Specified by:
getNumOfRacksin interfaceNetworkTopology- Returns:
- number of racks in the network topology.
-
getLeaves
Description copied from interface:NetworkTopologyReturns the nodes under a location.- Specified by:
getLeavesin interfaceNetworkTopology- Parameters:
loc- network location- Returns:
- nodes under a location
-
countNumOfAvailableNodes
Description copied from interface:NetworkTopologyReturn the number of leaves in scope but not in excludedNodes.If scope starts with ~, return the number of nodes that are not in scope and excludedNodes;
- Specified by:
countNumOfAvailableNodesin interfaceNetworkTopology- Parameters:
scope- a path string that may start with ~excludedNodes- a list of nodes- Returns:
- number of available nodes
-