You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by st...@apache.org on 2021/12/20 14:43:56 UTC

[jackrabbit-oak] branch trunk updated: OAK-9644: Flaky test due to HashSet (#442)

This is an automated email from the ASF dual-hosted git repository.

stefanegli pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


The following commit(s) were added to refs/heads/trunk by this push:
     new e984bd1  OAK-9644: Flaky test due to HashSet (#442)
e984bd1 is described below

commit e984bd1c1375e3cea19b4a05b979b54ea5061336
Author: Marcel Reutegger <mr...@apache.org>
AuthorDate: Mon Dec 20 15:43:49 2021 +0100

    OAK-9644: Flaky test due to HashSet (#442)
    
    * OAK-9644: Flaky test due to HashSet
    Use sorted stream as suggested by Carlo Jelmini
    PR originally proposed by LeoYimingLi, thx!
---
 .../jackrabbit/oak/plugins/document/ClusterView.java     | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterView.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterView.java
index be0157d..5ea00bc 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterView.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterView.java
@@ -19,7 +19,6 @@
 package org.apache.jackrabbit.oak.plugins.document;
 
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 import org.apache.jackrabbit.oak.commons.json.JsopBuilder;
@@ -187,22 +186,13 @@ class ClusterView {
         builder.key("id").value(clusterId);
         builder.key("me").value(localId);
         builder.key("active").array();
-        for (Iterator<Integer> it = activeIds.iterator(); it.hasNext();) {
-            Integer anInstance = it.next();
-            builder.value(anInstance);
-        }
+        activeIds.stream().sorted().forEachOrdered(builder::value);
         builder.endArray();
         builder.key("deactivating").array();
-        for (Iterator<Integer> it = deactivatingIds.iterator(); it.hasNext();) {
-            Integer anInstance = it.next();
-            builder.value(anInstance);
-        }
+        deactivatingIds.stream().sorted().forEachOrdered(builder::value);
         builder.endArray();
         builder.key("inactive").array();
-        for (Iterator<Integer> it = inactiveIds.iterator(); it.hasNext();) {
-            Integer anInstance = it.next();
-            builder.value(anInstance);
-        }
+        inactiveIds.stream().sorted().forEachOrdered(builder::value);
         builder.endArray();
         builder.endObject();
         return builder.toString();