Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static void sendHeartbeats(org.neo4j.causalclustering.core.consensus.state.ReadableRaftState ctx, org.neo4j.causalclustering.core.consensus.outcome.Outcome outcome) throws java.io.IOException
        internal static void SendHeartbeats(ReadableRaftState ctx, Outcome outcome)
        {
            long commitIndex                 = ctx.CommitIndex();
            long commitIndexTerm             = ctx.EntryLog().readEntryTerm(commitIndex);
            RaftMessages_Heartbeat heartbeat = new RaftMessages_Heartbeat(ctx.Myself(), ctx.Term(), commitIndex, commitIndexTerm);

            foreach (MemberId to in ReplicationTargets(ctx))
            {
                outcome.AddOutgoingMessage(new Org.Neo4j.causalclustering.core.consensus.RaftMessages_Directed(to, heartbeat));
            }
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.causalclustering.core.consensus.outcome.Outcome handle(org.neo4j.causalclustering.core.consensus.RaftMessages_Heartbeat heartbeat) throws java.io.IOException
            public override Outcome Handle(RaftMessages_Heartbeat heartbeat)
            {
                if (heartbeat.LeaderTerm() < Ctx.term())
                {
                    return(Outcome);
                }

                StepDownToFollower(Outcome, Ctx);
                Log.info("Moving to FOLLOWER state after receiving heartbeat at term %d (my term is " + "%d) from %s", heartbeat.LeaderTerm(), Ctx.term(), heartbeat.From());
                Heart.Beat(Ctx, Outcome, heartbeat, Log);
                return(Outcome);
            }
Example #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.causalclustering.core.consensus.outcome.Outcome handle(org.neo4j.causalclustering.core.consensus.RaftMessages_Heartbeat heartbeat) throws java.io.IOException
            public override Outcome Handle(RaftMessages_Heartbeat heartbeat)
            {
                Heart.Beat(Ctx, Outcome, heartbeat, Log);
                return(Outcome);
            }