Skip to content

Commit

Permalink
TeachingSynchronizer: fixed sub-tree order
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Ananev <[email protected]>
  • Loading branch information
artemananiev committed Apr 12, 2024
1 parent 46b11d3 commit 980ac5c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.net.SocketException;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
Expand Down Expand Up @@ -139,7 +139,7 @@ public TeachingSynchronizer(
public void synchronize() throws InterruptedException {
try {
while (!subtrees.isEmpty()) {
final Set<TeacherSubtree> toSync = new HashSet<>();
final List<TeacherSubtree> toSync = new ArrayList<>();
int count = 0;
while (!subtrees.isEmpty() && (count < reconnectConfig.maxParallelSubtrees())) {
toSync.add(subtrees.remove());
Expand All @@ -155,7 +155,7 @@ public void synchronize() throws InterruptedException {
}
}

private void sendTreesInParallel(final Set<TeacherSubtree> toSend) throws InterruptedException {
private void sendTreesInParallel(final List<TeacherSubtree> toSend) throws InterruptedException {
final AtomicReference<Throwable> firstReconnectException = new AtomicReference<>();
final Function<Throwable, Boolean> reconnectExceptionListener = ex -> {
Throwable cause = ex;
Expand Down

0 comments on commit 980ac5c

Please sign in to comment.