use of org.neo4j.causalclustering.core.replication.SendToMyself in project neo4j by neo4j.
the class RaftMachineBuilder method build.
public RaftMachine build() {
SendToMyself leaderOnlyReplicator = new SendToMyself(member, outbound);
RaftMembershipManager membershipManager = new RaftMembershipManager(leaderOnlyReplicator, memberSetBuilder, raftLog, logProvider, expectedClusterSize, electionTimeout, clock, catchupTimeout, raftMembership);
membershipManager.setRecoverFromIndexSupplier(() -> 0);
RaftLogShippingManager logShipping = new RaftLogShippingManager(outbound, logProvider, raftLog, shippingClock, member, membershipManager, retryTimeMillis, catchupBatchSize, maxAllowedShippingLag, inFlightMap);
RaftMachine raft = new RaftMachine(member, termState, voteState, raftLog, electionTimeout, heartbeatInterval, renewableTimeoutService, outbound, logProvider, membershipManager, logShipping, inFlightMap, false, monitors, clock);
inbound.registerHandler((incomingMessage) -> {
try {
ConsensusOutcome outcome = raft.handle(incomingMessage);
commitListener.notifyCommitted(outcome.getCommitIndex());
} catch (IOException e) {
throw new RuntimeException(e);
}
});
try {
membershipManager.start();
} catch (IOException e) {
throw new RuntimeException(e);
}
return raft;
}
Aggregations