summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
f3dcde7)
This series of patches uses lambdas instead of anonymous classes for
functional interfaces when possible. Lambdas are replaced with method
references when appropriate.
Change-Id: I1c48105a90efa73c1cb7ae2fba9111f74951fe11
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Preconditions.checkNotNull(timeout);
Preconditions.checkNotNull(actor);
cancelTimer = actor.getContext().system().scheduler().scheduleOnce(timeout, actor.self(),
Preconditions.checkNotNull(timeout);
Preconditions.checkNotNull(actor);
cancelTimer = actor.getContext().system().scheduler().scheduleOnce(timeout, actor.self(),
- (Runnable) () -> cancel(), actor.getContext().system().dispatcher(), actor.self());
+ (Runnable) this::cancel, actor.getContext().system().dispatcher(), actor.self());
// Wait for the isolated leader to send AppendEntries to the followers with the new entry with index 1. This
// message is forwarded to the followers.
// Wait for the isolated leader to send AppendEntries to the followers with the new entry with index 1. This
// message is forwarded to the followers.
- expectFirstMatching(follower1CollectorActor, AppendEntries.class, ae -> {
- return ae.getEntries().size() == 1 && ae.getEntries().get(0).getIndex() == 1
- && ae.getEntries().get(0).getData().equals(payload1);
- });
+ expectFirstMatching(follower1CollectorActor, AppendEntries.class, ae ->
+ ae.getEntries().size() == 1 && ae.getEntries().get(0).getIndex() == 1
+ && ae.getEntries().get(0).getData().equals(payload1));
- expectFirstMatching(follower2CollectorActor, AppendEntries.class, ae -> {
- return ae.getEntries().size() == 1 && ae.getEntries().get(0).getIndex() == 1
- && ae.getEntries().get(0).getData().equals(payload1);
- });
+ expectFirstMatching(follower2CollectorActor, AppendEntries.class, ae ->
+ ae.getEntries().size() == 1 && ae.getEntries().get(0).getIndex() == 1
+ && ae.getEntries().get(0).getData().equals(payload1));
verifyApplyJournalEntries(leaderCollectorActor, 1);
verifyApplyJournalEntries(leaderCollectorActor, 1);
// Wait for the isolated leader to send AppendEntries to the followers with the new entry with index 1. This
// message is forwarded to the followers.
// Wait for the isolated leader to send AppendEntries to the followers with the new entry with index 1. This
// message is forwarded to the followers.
- expectFirstMatching(follower1CollectorActor, AppendEntries.class, ae -> {
- return ae.getEntries().size() == 1 && ae.getEntries().get(0).getIndex() == 1
- && ae.getEntries().get(0).getData().equals(payload1);
- });
+ expectFirstMatching(follower1CollectorActor, AppendEntries.class, ae ->
+ ae.getEntries().size() == 1 && ae.getEntries().get(0).getIndex() == 1
+ && ae.getEntries().get(0).getData().equals(payload1));
- expectFirstMatching(follower2CollectorActor, AppendEntries.class, ae -> {
- return ae.getEntries().size() == 1 && ae.getEntries().get(0).getIndex() == 1
- && ae.getEntries().get(0).getData().equals(payload1);
- });
+ expectFirstMatching(follower2CollectorActor, AppendEntries.class, ae ->
+ ae.getEntries().size() == 1 && ae.getEntries().get(0).getIndex() == 1
+ && ae.getEntries().get(0).getData().equals(payload1));
verifyApplyJournalEntries(leaderCollectorActor, 1);
verifyApplyJournalEntries(leaderCollectorActor, 1);
actorContext.getReplicatedLog().removeFrom(0);
AtomicReference<java.util.Optional<OutputStream>> installSnapshotStream = new AtomicReference<>();
actorContext.getReplicatedLog().removeFrom(0);
AtomicReference<java.util.Optional<OutputStream>> installSnapshotStream = new AtomicReference<>();
- actorContext.setCreateSnapshotProcedure(out -> installSnapshotStream.set(out));
+ actorContext.setCreateSnapshotProcedure(installSnapshotStream::set);
leader = new Leader(actorContext);
actorContext.setCurrentBehavior(leader);
leader = new Leader(actorContext);
actorContext.setCurrentBehavior(leader);