コード例 #1
0
        public override Response Description()
        {
            ICollection <MemberId> votingMembers = _topologyService.allCoreRoles().Keys;
            bool     isHealthy            = _dbHealth.Healthy;
            MemberId memberId             = _topologyService.myself();
            MemberId leader               = _topologyService.allCoreRoles().Keys.Where(member => RoleInfo.LEADER.Equals(_topologyService.allCoreRoles()[member])).First().orElse(null);
            long     lastAppliedRaftIndex = _commandIndexTracker.AppliedCommandIndex;
            // leader message duration is meaningless for replicas since communication is not guaranteed with leader and transactions are streamed periodically
            Duration millisSinceLastLeaderMessage = null;

            return(StatusResponse(lastAppliedRaftIndex, false, votingMembers, isHealthy, memberId, leader, millisSinceLastLeaderMessage, false));
        }
コード例 #2
0
        public override Response Description()
        {
            MemberId         myself                   = _topologyService.myself();
            MemberId         leader                   = Leader;
            IList <MemberId> votingMembers            = new List <MemberId>(_raftMembershipManager.votingMembers());
            bool             participatingInRaftGroup = votingMembers.Contains(myself) && Objects.nonNull(leader);

            long lastAppliedRaftIndex = _commandIndexTracker.AppliedCommandIndex;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.time.Duration millisSinceLastLeaderMessage;
            Duration millisSinceLastLeaderMessage;

            if (myself.Equals(leader))
            {
                millisSinceLastLeaderMessage = Duration.ofMillis(0);
            }
            else
            {
                millisSinceLastLeaderMessage = _raftMessageTimerResetMonitor.durationSinceLastMessage();
            }

            return(StatusResponse(lastAppliedRaftIndex, participatingInRaftGroup, votingMembers, _databaseHealth.Healthy, myself, leader, millisSinceLastLeaderMessage, true));
        }