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

lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new da7e5458c1e [fix][test] Cleanup cached executors in tests (#21383)
da7e5458c1e is described below

commit da7e5458c1eb245ba30d4a65422df19f1b0ae4b2
Author: Lari Hotari <[email protected]>
AuthorDate: Wed Oct 18 03:06:03 2023 +0300

    [fix][test] Cleanup cached executors in tests (#21383)
---
 .../pulsar/common/util/collections/ConcurrentLongHashMapTest.java     | 1 +
 .../common/util/collections/ConcurrentLongLongPairHashMapTest.java    | 4 ++++
 .../pulsar/common/util/collections/ConcurrentLongPairSetTest.java     | 1 +
 .../pulsar/common/util/collections/ConcurrentOpenHashMapTest.java     | 1 +
 .../pulsar/common/util/collections/ConcurrentOpenHashSetTest.java     | 1 +
 .../apache/pulsar/metadata/bookkeeper/LedgerManagerIteratorTest.java  | 1 +
 6 files changed, 9 insertions(+)

diff --git 
a/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentLongHashMapTest.java
 
b/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentLongHashMapTest.java
index e1f947ad8c4..60bfbd31c28 100644
--- 
a/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentLongHashMapTest.java
+++ 
b/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentLongHashMapTest.java
@@ -224,6 +224,7 @@ public class ConcurrentLongHashMapTest {
                 .build();
         assertEquals(map.capacity(), 4);
 
+        @Cleanup("shutdownNow")
         ExecutorService executor = Executors.newCachedThreadPool();
         final int readThreads = 16;
         final int writeThreads = 1;
diff --git 
a/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentLongLongPairHashMapTest.java
 
b/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentLongLongPairHashMapTest.java
index 0de3fdb5c84..e2d7c77f516 100644
--- 
a/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentLongLongPairHashMapTest.java
+++ 
b/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentLongLongPairHashMapTest.java
@@ -37,6 +37,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicReference;
 
+import lombok.Cleanup;
 import 
org.apache.pulsar.common.util.collections.ConcurrentLongLongPairHashMap.LongPair;
 import org.testng.annotations.Test;
 
@@ -186,6 +187,7 @@ public class ConcurrentLongLongPairHashMapTest {
                 .build();
         assertEquals(map.capacity(), 4);
 
+        @Cleanup("shutdownNow")
         ExecutorService executor = Executors.newCachedThreadPool();
         final int readThreads = 16;
         final int writeThreads = 1;
@@ -335,6 +337,7 @@ public class ConcurrentLongLongPairHashMapTest {
     public void concurrentInsertions() throws Throwable {
         ConcurrentLongLongPairHashMap map = 
ConcurrentLongLongPairHashMap.newBuilder()
                 .build();
+        @Cleanup("shutdownNow")
         ExecutorService executor = Executors.newCachedThreadPool();
 
         final int nThreads = 16;
@@ -375,6 +378,7 @@ public class ConcurrentLongLongPairHashMapTest {
     public void concurrentInsertionsAndReads() throws Throwable {
         ConcurrentLongLongPairHashMap map = 
ConcurrentLongLongPairHashMap.newBuilder()
                 .build();
+        @Cleanup("shutdownNow")
         ExecutorService executor = Executors.newCachedThreadPool();
 
         final int nThreads = 16;
diff --git 
a/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentLongPairSetTest.java
 
b/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentLongPairSetTest.java
index bce2b899383..9c8655b21cf 100644
--- 
a/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentLongPairSetTest.java
+++ 
b/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentLongPairSetTest.java
@@ -223,6 +223,7 @@ public class ConcurrentLongPairSetTest {
                 .build();
         assertEquals(set.capacity(), 4);
 
+        @Cleanup("shutdownNow")
         ExecutorService executor = Executors.newCachedThreadPool();
         final int readThreads = 16;
         final int writeThreads = 1;
diff --git 
a/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentOpenHashMapTest.java
 
b/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentOpenHashMapTest.java
index 410d490b98f..8ff00a022b3 100644
--- 
a/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentOpenHashMapTest.java
+++ 
b/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentOpenHashMapTest.java
@@ -227,6 +227,7 @@ public class ConcurrentOpenHashMapTest {
                 .build();
         assertEquals(map.capacity(), 4);
 
+        @Cleanup("shutdownNow")
         ExecutorService executor = Executors.newCachedThreadPool();
         final int readThreads = 16;
         final int writeThreads = 1;
diff --git 
a/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentOpenHashSetTest.java
 
b/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentOpenHashSetTest.java
index 6a40095ab06..29722ed7821 100644
--- 
a/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentOpenHashSetTest.java
+++ 
b/pulsar-common/src/test/java/org/apache/pulsar/common/util/collections/ConcurrentOpenHashSetTest.java
@@ -198,6 +198,7 @@ public class ConcurrentOpenHashSetTest {
                 .build();
         assertEquals(set.capacity(), 4);
 
+        @Cleanup("shutdownNow")
         ExecutorService executor = Executors.newCachedThreadPool();
         final int readThreads = 16;
         final int writeThreads = 1;
diff --git 
a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/bookkeeper/LedgerManagerIteratorTest.java
 
b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/bookkeeper/LedgerManagerIteratorTest.java
index b64cc964a99..f8a51602686 100644
--- 
a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/bookkeeper/LedgerManagerIteratorTest.java
+++ 
b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/bookkeeper/LedgerManagerIteratorTest.java
@@ -403,6 +403,7 @@ public class LedgerManagerIteratorTest extends 
BaseMetadataStoreTest {
         final long start = MathUtils.nowInNano();
         final CountDownLatch latch = new CountDownLatch(1);
         ArrayList<Future<?>> futures = new ArrayList<>();
+        @Cleanup("shutdownNow")
         ExecutorService executor = Executors.newCachedThreadPool();
         final ConcurrentSkipListSet<Long> createdLedgers = new 
ConcurrentSkipListSet<>();
         for (int i = 0; i < numWriters; ++i) {

Reply via email to