类 BaseNodeCache

    • 字段详细资料

      • HEARTBEAT_TIMEOUT_TIME

        public static final int HEARTBEAT_TIMEOUT_TIME
        另请参阅:
        常量字段值
      • MAXIMUM_WINDOW_SIZE

        public static final int MAXIMUM_WINDOW_SIZE
        另请参阅:
        常量字段值
      • previousStatistics

        protected volatile NodeStatistics previousStatistics
      • currentStatistics

        protected volatile NodeStatistics currentStatistics
    • 构造器详细资料

      • BaseNodeCache

        protected BaseNodeCache()
        Constructor for NodeCache with default NodeStatistics
    • 方法详细资料

      • 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