From 980ac5cd068abd13dbde5baf6d81274f0e06cae0 Mon Sep 17 00:00:00 2001 From: Artem Ananev Date: Thu, 11 Apr 2024 18:33:00 -0700 Subject: [PATCH] TeachingSynchronizer: fixed sub-tree order Signed-off-by: Artem Ananev --- .../merkle/synchronization/TeachingSynchronizer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform-sdk/swirlds-common/src/main/java/com/swirlds/common/merkle/synchronization/TeachingSynchronizer.java b/platform-sdk/swirlds-common/src/main/java/com/swirlds/common/merkle/synchronization/TeachingSynchronizer.java index 9cd71b84bac1..1690722789a6 100644 --- a/platform-sdk/swirlds-common/src/main/java/com/swirlds/common/merkle/synchronization/TeachingSynchronizer.java +++ b/platform-sdk/swirlds-common/src/main/java/com/swirlds/common/merkle/synchronization/TeachingSynchronizer.java @@ -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; @@ -139,7 +139,7 @@ public TeachingSynchronizer( public void synchronize() throws InterruptedException { try { while (!subtrees.isEmpty()) { - final Set toSync = new HashSet<>(); + final List toSync = new ArrayList<>(); int count = 0; while (!subtrees.isEmpty() && (count < reconnectConfig.maxParallelSubtrees())) { toSync.add(subtrees.remove()); @@ -155,7 +155,7 @@ public void synchronize() throws InterruptedException { } } - private void sendTreesInParallel(final Set toSend) throws InterruptedException { + private void sendTreesInParallel(final List toSend) throws InterruptedException { final AtomicReference firstReconnectException = new AtomicReference<>(); final Function reconnectExceptionListener = ex -> { Throwable cause = ex;