@Test public void testNeedsLeaderAddress() { logStart("testNeedsLeaderAddress"); MockRaftActorContext context = createActorContext(); context.setReplicatedLog(new MockRaftActorContext.SimpleReplicatedLog()); context.addToPeers("leader", null, VotingState.VOTING); ((DefaultConfigParamsImpl)context.getConfigParams()).setPeerAddressResolver(NoopPeerAddressResolver.INSTANCE); follower = createBehavior(context); follower.handleMessage(leaderActor, new AppendEntries(1, "leader", -1, -1, Collections.emptyList(), -1, -1, (short)0)); AppendEntriesReply reply = MessageCollectorActor.expectFirstMatching(leaderActor, AppendEntriesReply.class); assertTrue(reply.isNeedsLeaderAddress()); MessageCollectorActor.clearMessages(leaderActor); PeerAddressResolver mockResolver = mock(PeerAddressResolver.class); ((DefaultConfigParamsImpl)context.getConfigParams()).setPeerAddressResolver(mockResolver); follower.handleMessage(leaderActor, new AppendEntries(1, "leader", -1, -1, Collections.emptyList(), -1, -1, (short)0, RaftVersions.CURRENT_VERSION, leaderActor.path().toString())); reply = MessageCollectorActor.expectFirstMatching(leaderActor, AppendEntriesReply.class); assertFalse(reply.isNeedsLeaderAddress()); verify(mockResolver).setResolved("leader", leaderActor.path().toString()); }
private boolean needsLeaderAddress() { return context.getPeerAddress(leaderId) == null; }
Follower extends AbstractRaftActorBehavior { private boolean needsLeaderAddress() { return context.getPeerAddress(leaderId) == null; } }
Follower extends AbstractRaftActorBehavior { private boolean needsLeaderAddress() { return context.getPeerAddress(leaderId) == null; } Follower(final RaftActorContext context);  Follower(final RaftActorContext context, final String initialLeaderId,
            final short initialLeaderPayloadVersion); }
Follower extends AbstractRaftActorBehavior { private boolean needsLeaderAddress() { return context.getPeerAddress(leaderId) == null; } Follower(final RaftActorContext context);  Follower(final RaftActorContext context, final String initialLeaderId,
            final short initialLeaderPayloadVersion); @Override final String getLeaderId(); @Override short getLeaderPayloadVersion(); @Override RaftActorBehavior handleMessage(final ActorRef sender, final Object message); @Override void close(); }
Follower extends AbstractRaftActorBehavior { private boolean needsLeaderAddress() { return context.getPeerAddress(leaderId) == null; } Follower(final RaftActorContext context);  Follower(final RaftActorContext context, final String initialLeaderId,
            final short initialLeaderPayloadVersion); @Override final String getLeaderId(); @Override short getLeaderPayloadVersion(); @Override RaftActorBehavior handleMessage(final ActorRef sender, final Object message); @Override void close();  }