类 BaseNodeCache
- java.lang.Object
-
- org.apache.iotdb.confignode.manager.node.heartbeat.BaseNodeCache
-
public abstract class BaseNodeCache extends java.lang.ObjectAll the statistic interfaces that provided by HeartbeatCache
-
-
字段概要
字段 修饰符和类型 字段 说明 protected NodeStatisticscurrentStatisticsstatic intHEARTBEAT_TIMEOUT_TIMEstatic intMAXIMUM_WINDOW_SIZEprotected NodeStatisticspreviousStatisticsprotected java.util.LinkedList<NodeHeartbeatSample>slidingWindow
-
构造器概要
构造器 限定符 构造器 说明 protectedBaseNodeCache()Constructor for NodeCache with default NodeStatistics
-
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 voidcacheHeartbeatSample(NodeHeartbeatSample newHeartbeatSample)Cache the newest NodeHeartbeatSamplevoidforceUpdate(NodeHeartbeatSample newHeartbeatSample)Actively append a custom NodeHeartbeatSample to force a change in the NodeStatistics.longgetLoadScore()TODO: The loadScore of each Node will be changed to Doubleorg.apache.iotdb.commons.cluster.NodeStatusgetNodeStatus()java.lang.StringgetNodeStatusWithReason()NodeStatisticsgetStatistics()booleanperiodicUpdate()Invoking periodically in the Cluster-LoadStatistics-Service to update currentStatistics and compare with the previousStatistics, in order to detect whether the Node's statistics has changedprotected abstract voidupdateCurrentStatistics()Update currentStatistics based on recent NodeHeartbeatSamples that cached in the slidingWindow
-
-
-
字段详细资料
-
HEARTBEAT_TIMEOUT_TIME
public static final int HEARTBEAT_TIMEOUT_TIME
- 另请参阅:
- 常量字段值
-
MAXIMUM_WINDOW_SIZE
public static final int MAXIMUM_WINDOW_SIZE
- 另请参阅:
- 常量字段值
-
slidingWindow
protected final java.util.LinkedList<NodeHeartbeatSample> slidingWindow
-
previousStatistics
protected volatile NodeStatistics previousStatistics
-
currentStatistics
protected volatile NodeStatistics currentStatistics
-
-
方法详细资料
-
cacheHeartbeatSample
public void cacheHeartbeatSample(NodeHeartbeatSample newHeartbeatSample)
Cache the newest NodeHeartbeatSample- 参数:
newHeartbeatSample- The newest NodeHeartbeatSample
-
periodicUpdate
public boolean periodicUpdate()
Invoking periodically in the Cluster-LoadStatistics-Service to update currentStatistics and compare with the previousStatistics, in order to detect whether the Node's statistics has changed- 返回:
- True if the currentStatistics has changed recently(compare with the previousStatistics), false otherwise
-
forceUpdate
public void forceUpdate(NodeHeartbeatSample newHeartbeatSample)
Actively append a custom NodeHeartbeatSample to force a change in the NodeStatistics.For example, this interface can be invoked in Node removing process to forcibly change the corresponding Node's status to Removing without waiting for heartbeat sampling
Notice: The ConfigNode-leader doesn't know the specified Node's statistics has changed even if this interface is invoked, since the ConfigNode-leader only detect cluster Nodes' statistics by periodicUpdate interface. However, other service can still read the update of currentStatistics by invoking getters below.
- 参数:
newHeartbeatSample- A custom NodeHeartbeatSample that will lead to needed NodeStatistics
-
updateCurrentStatistics
protected abstract void updateCurrentStatistics()
Update currentStatistics based on recent NodeHeartbeatSamples that cached in the slidingWindow
-
getLoadScore
public long getLoadScore()
TODO: The loadScore of each Node will be changed to Double- 返回:
- The latest load score of a node, the higher the score the higher the load
-
getNodeStatus
public org.apache.iotdb.commons.cluster.NodeStatus getNodeStatus()
- 返回:
- The current status of the Node
-
getNodeStatusWithReason
public java.lang.String getNodeStatusWithReason()
- 返回:
- The reason why lead to current NodeStatus
-
getStatistics
public NodeStatistics getStatistics()
-
-