Ejemplo n.º 1
0
        public override void OnMembershipChanged()
        {
            lock (this)
            {
                if (_lastLeaderContext == null || !_running)
                {
                    return;
                }

                IDictionary <MemberId, RaftLogShipper> .KeyCollection toBeRemoved = new HashSet <MemberId>(_logShippers.Keys);
                toBeRemoved.removeAll(_membership.replicationMembers());

                foreach (MemberId member in toBeRemoved)
                {
                    RaftLogShipper logShipper = _logShippers.Remove(member);
                    if (logShipper != null)
                    {
                        logShipper.Stop();
                    }
                }

                foreach (MemberId replicationMember in _membership.replicationMembers())
                {
                    EnsureLogShipperRunning(replicationMember, _lastLeaderContext);
                }
            }
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @After public void teardown()
        public virtual void Teardown()
        {
            if (_logShipper != null)
            {
                _logShipper.stop();
                _logShipper = null;
            }
        }
Ejemplo n.º 3
0
        private void EnsureLogShipperRunning(MemberId member, LeaderContext leaderContext)
        {
            RaftLogShipper logShipper = _logShippers[member];

            if (logShipper == null && !member.Equals(_myself))
            {
                logShipper = new RaftLogShipper(_outbound, _logProvider, _raftLog, _clock, _timerService, _myself, member, leaderContext.Term, leaderContext.CommitIndex, _retryTimeMillis, _catchupBatchSize, _maxAllowedShippingLag, _inFlightCache);

                _logShippers[member] = logShipper;

                logShipper.Start();
            }
        }
Ejemplo n.º 4
0
 private void StartLogShipper()
 {
     _logShipper = new RaftLogShipper(_outbound, _logProvider, _raftLog, _clock, _timerService, _leader, _follower, _leaderTerm, _leaderCommit, _retryTimeMillis, _catchupBatchSize, _maxAllowedShippingLag, new ConsecutiveInFlightCache());
     _logShipper.start();
 }