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

reschke pushed a commit to branch SLING-12894
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git


The following commit(s) were added to refs/heads/SLING-12894 by this push:
     new 044127f9 SLING-12894: alias refactoring - support observation events 
while bg init not finished
044127f9 is described below

commit 044127f9667958a4baa5b65b1e5c4090b928103e
Author: Julian Reschke <[email protected]>
AuthorDate: Fri Aug 22 14:37:52 2025 +0100

    SLING-12894: alias refactoring - support observation events while bg init 
not finished
---
 .../resourceresolver/impl/mapping/AliasMapEntriesTest.java     | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git 
a/src/test/java/org/apache/sling/resourceresolver/impl/mapping/AliasMapEntriesTest.java
 
b/src/test/java/org/apache/sling/resourceresolver/impl/mapping/AliasMapEntriesTest.java
index db2bd0a3..a029c99a 100644
--- 
a/src/test/java/org/apache/sling/resourceresolver/impl/mapping/AliasMapEntriesTest.java
+++ 
b/src/test/java/org/apache/sling/resourceresolver/impl/mapping/AliasMapEntriesTest.java
@@ -31,6 +31,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.regex.Matcher;
@@ -1253,14 +1254,11 @@ public class AliasMapEntriesTest extends 
AbstractMappingMapEntriesTest {
         Resource leaf = createMockedResource(top, "leaf");
         
when(leaf.getValueMap()).thenReturn(buildValueMap(ResourceResolverImpl.PROP_ALIAS,
 "alias"));
 
-        AtomicBoolean greenLight = new AtomicBoolean(false);
+        CountDownLatch greenLight = new CountDownLatch(1);
 
         when(resourceResolver.findResources(anyString(), eq("JCR-SQL2")))
                 .thenAnswer((Answer<Iterator<Resource>>) invocation -> {
-                    while (!greenLight.get()) {
-                        // yes, busy wait; eat this, code quality checkers
-                        Thread.sleep(10);
-                    }
+                    greenLight.await();
                     return Set.of(leaf).iterator();
                 });
 
@@ -1276,7 +1274,7 @@ public class AliasMapEntriesTest extends 
AbstractMappingMapEntriesTest {
         mapEntries.onChange(List.of(new 
ResourceChange(ResourceChange.ChangeType.REMOVED, leaf.getPath(), false)));
         // mapEntries.onChange(List.of(new 
ResourceChange(ResourceChange.ChangeType.ADDED, leaf2.getPath(), false)));
 
-        greenLight.set(true);
+        greenLight.countDown();
         waitForBgInit();
 
         assertTrue(ah.isReady());

Reply via email to