You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2020/04/19 15:48:09 UTC

[curator] branch CURATOR-559-fix-nested-retry-loops-reopen created (now 62cd345)

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

randgalt pushed a change to branch CURATOR-559-fix-nested-retry-loops-reopen
in repository https://gitbox.apache.org/repos/asf/curator.git.


      at 62cd345  CURATOR-559 test used InterProcessReadWriteLock - the problem is that the retry can end up in background loop which has its own thread thereby spoiling the test. Instead use a foreground operation for consistent tests

This branch includes the following new commits:

     new 62cd345  CURATOR-559 test used InterProcessReadWriteLock - the problem is that the retry can end up in background loop which has its own thread thereby spoiling the test. Instead use a foreground operation for consistent tests

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[curator] 01/01: CURATOR-559 test used InterProcessReadWriteLock - the problem is that the retry can end up in background loop which has its own thread thereby spoiling the test. Instead use a foreground operation for consistent tests

Posted by ra...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch CURATOR-559-fix-nested-retry-loops-reopen
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 62cd345389eacb39623a67e383a4cf38c8921f39
Author: randgalt <ra...@apache.org>
AuthorDate: Sun Apr 19 10:47:57 2020 -0500

    CURATOR-559 test used InterProcessReadWriteLock - the problem is that the retry can end up in background loop which has its own thread thereby spoiling the test. Instead use a foreground operation for consistent tests
---
 .../apache/curator/connection/TestThreadLocalRetryLoop.java  | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
index 16b345a..56362e6 100644
--- a/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
+++ b/curator-recipes/src/test/java/org/apache/curator/connection/TestThreadLocalRetryLoop.java
@@ -22,7 +22,6 @@ import org.apache.curator.RetryPolicy;
 import org.apache.curator.RetrySleeper;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.RetryNTimes;
 import org.apache.curator.test.compatibility.CuratorTestBase;
@@ -46,7 +45,7 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
         try (CuratorFramework client = newClient(count))
         {
             prep(client);
-            doLock(client);
+            doOperation(client);
             Assert.assertEquals(count.get(), retryCount + 1);    // Curator's retry policy has been off by 1 since inception - we might consider fixing it someday
         }
     }
@@ -62,10 +61,10 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
             prep(client);
             for ( int i = 0; i < threadQty; ++i )
             {
-                executorService.submit(() -> doLock(client));
+                executorService.submit(() -> doOperation(client));
             }
             executorService.shutdown();
-            executorService.awaitTermination(timing.milliseconds(), TimeUnit.MILLISECONDS);
+            Assert.assertTrue(executorService.awaitTermination(timing.milliseconds(), TimeUnit.MILLISECONDS));
             Assert.assertEquals(count.get(), threadQty * (retryCount + 1));    // Curator's retry policy has been off by 1 since inception - we might consider fixing it someday
         }
     }
@@ -97,12 +96,11 @@ public class TestThreadLocalRetryLoop extends CuratorTestBase
         Assert.assertTrue(timing.awaitLatch(lostLatch));
     }
 
-    private Void doLock(CuratorFramework client) throws Exception
+    private Void doOperation(CuratorFramework client) throws Exception
     {
-        InterProcessReadWriteLock lock = new InterProcessReadWriteLock(client, "/test/lock");
         try
         {
-            lock.readLock().acquire();
+            client.checkExists().forPath("/hey");
             Assert.fail("Should have thrown an exception");
         }
         catch ( KeeperException ignore )