Skip to content

Commit

Permalink
Add executor in StateMachine4InstallSnapshotNotificationTests
Browse files Browse the repository at this point in the history
  • Loading branch information
adoroszlai committed Aug 5, 2022
1 parent 374396d commit f642b14
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Supplier;
Expand Down Expand Up @@ -85,6 +87,9 @@ public abstract class InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
private static final AtomicInteger numNotifyInstallSnapshotFinished = new AtomicInteger();

private static class StateMachine4InstallSnapshotNotificationTests extends SimpleStateMachine4Testing {

private final Executor stateMachineExecutor = Executors.newSingleThreadExecutor();

@Override
public CompletableFuture<TermIndex> notifyInstallSnapshotFromLeader(
RaftProtos.RoleInfoProto roleInfoProto,
Expand Down Expand Up @@ -120,7 +125,7 @@ public CompletableFuture<TermIndex> notifyInstallSnapshotFromLeader(
return leaderSnapshotInfo.getTermIndex();
};

return CompletableFuture.supplyAsync(supplier);
return CompletableFuture.supplyAsync(supplier, stateMachineExecutor);
}

@Override
Expand Down

0 comments on commit f642b14

Please sign in to comment.