This is an automated email from the ASF dual-hosted git repository.
tison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git
The following commit(s) were added to refs/heads/master by this push:
new 75d3c196 Remove testIsolatedThreadGroup
75d3c196 is described below
commit 75d3c196cd40745ac8c3cd9040f4043168b704f5
Author: tison <[email protected]>
AuthorDate: Tue Jul 12 20:39:56 2022 +0800
Remove testIsolatedThreadGroup
These tests are for deprecated TreeCache and PathChildrenCache.
The functionality of isolated thread group can be easily verified from the
code change in commit 83de54888d39173acd7ddad0435f955e4ba736b1, while the tests
are flaky due to ThreadGroup::destory is flawed.
The ThreadGroup::destory method is terminally deprecated in JDK16. See also:
* https://bugs.openjdk.org/browse/JDK-8219197
* https://bugs.openjdk.org/browse/JDK-8220516
And thus we remove the tests for keep CI stable.
FWIW the downstream use cases previously meet the issue in CURATOR-640 are
currently happy to use 5.3.0 with the patch and no further failure report.
Signed-off-by: tison <[email protected]>
---
.../recipes/cache/TestPathChildrenCache.java | 52 +++++-----------------
.../framework/recipes/cache/TestTreeCache.java | 44 ------------------
2 files changed, 10 insertions(+), 86 deletions(-)
diff --git
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
index 89dd2fc5..72ef2725 100644
---
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
+++
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
@@ -48,7 +48,16 @@ import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import java.util.List;
-import java.util.concurrent.*;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Exchanger;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@@ -1151,45 +1160,4 @@ public class TestPathChildrenCache extends
BaseClassForTests
TestCleanState.closeAndTestClean(client);
}
}
-
- @Test
- public void testIsolatedThreadGroup() throws Exception {
- AtomicReference<Throwable> exception = new AtomicReference<>();
-
- CuratorFramework client =
CuratorFrameworkFactory.newClient(server.getConnectString(), 30000, 30000, new
RetryOneTime(1));
- client.getUnhandledErrorListenable().addListener((message, e) ->
exception.set(e));
- client.start();
-
- ThreadGroup threadGroup1 = new ThreadGroup("testGroup1");
- Thread thread1 = new Thread(threadGroup1, () -> {
- try ( final PathChildrenCache cache = new
PathChildrenCache(client, "/test1", true) ) {
- cache.start();
- Thread.sleep(1000);
- } catch (Exception e) {
- exception.set(e);
- }
- });
-
- thread1.start();
- thread1.join();
- assertNull(exception.get());
-
- // After the thread group is destroyed, all PathChildrenCache instances
- // will fail to start due to inability to add new threads into the
first thread group
- threadGroup1.destroy();
-
- ThreadGroup threadGroup2 = new ThreadGroup("testGroup2");
- Thread thread2 = new Thread(threadGroup2, () -> {
- try ( final PathChildrenCache cache = new
PathChildrenCache(client, "/test1", true) ) {
- cache.start();
- Thread.sleep(1000);
- } catch (Exception e) {
- exception.set(e);
- }
- });
-
- thread2.start();
- thread2.join();
- assertNull(exception.get());
- }
}
diff --git
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
index 93692e6c..2b9e491c 100644
---
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
+++
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
@@ -25,12 +25,9 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.common.collect.ImmutableSet;
-import java.util.concurrent.atomic.AtomicReference;
import org.apache.curator.framework.CuratorFramework;
-import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.api.UnhandledErrorListener;
import org.apache.curator.framework.recipes.cache.TreeCacheEvent.Type;
-import org.apache.curator.retry.RetryOneTime;
import org.apache.curator.test.compatibility.CuratorTestBase;
import org.apache.curator.utils.CloseableUtils;
import org.apache.zookeeper.CreateMode;
@@ -643,45 +640,4 @@ public class TestTreeCache extends BaseTestTreeCache
assertNoMoreEvents();
}
-
- @Test
- public void testIsolatedThreadGroup() throws Exception {
- AtomicReference<Throwable> exception = new AtomicReference<>();
-
- CuratorFramework client =
CuratorFrameworkFactory.newClient(server.getConnectString(), 30000, 30000, new
RetryOneTime(1));
- client.getUnhandledErrorListenable().addListener((message, e) ->
exception.set(e));
- client.start();
-
- ThreadGroup threadGroup1 = new ThreadGroup("testGroup1");
- Thread thread1 = new Thread(threadGroup1, () -> {
- try ( final TreeCache cache = new TreeCache(client, "/test1") ) {
- cache.start();
- Thread.sleep(1000);
- } catch (Exception e) {
- exception.set(e);
- }
- });
-
- thread1.start();
- thread1.join();
- assertNull(exception.get());
-
- // After the thread group is destroyed, all PathChildrenCache instances
- // will fail to start due to inability to add new threads into the
first thread group
- threadGroup1.destroy();
-
- ThreadGroup threadGroup2 = new ThreadGroup("testGroup2");
- Thread thread2 = new Thread(threadGroup2, () -> {
- try ( final TreeCache cache = new TreeCache(client, "/test1") ) {
- cache.start();
- Thread.sleep(1000);
- } catch (Exception e) {
- exception.set(e);
- }
- });
-
- thread2.start();
- thread2.join();
- assertNull(exception.get());
- }
}