You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2023/10/27 03:23:07 UTC

[pulsar] branch master updated: [fix][test] Fix thread leak in concurrent collections tests (#21449)

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 b5ac12993bf [fix][test] Fix thread leak in concurrent collections tests (#21449)
b5ac12993bf is described below

commit b5ac12993bffb9f58e7b004c2744be8767bfa3db
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Thu Oct 26 20:23:01 2023 -0700

    [fix][test] Fix thread leak in concurrent collections tests (#21449)
---
 .../common/util/collections/ConcurrentLongLongPairHashMapTest.java      | 2 +-
 .../pulsar/common/util/collections/ConcurrentLongPairSetTest.java       | 2 +-
 .../pulsar/common/util/collections/ConcurrentOpenHashMapTest.java       | 2 +-
 .../pulsar/common/util/collections/ConcurrentOpenHashSetTest.java       | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

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 e2d7c77f516..7b7255bacc8 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
@@ -203,7 +203,7 @@ public class ConcurrentLongLongPairHashMapTest {
                 } catch (Exception e) {
                     throw new RuntimeException(e);
                 }
-                while (true) {
+                while (!Thread.currentThread().isInterrupted()) {
                     try {
                         map.get(1, 1);
                     } catch (Exception e) {
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 9c8655b21cf..0287e986b00 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
@@ -239,7 +239,7 @@ public class ConcurrentLongPairSetTest {
                 } catch (Exception e) {
                     throw new RuntimeException(e);
                 }
-                while (true) {
+                while (!Thread.currentThread().isInterrupted()) {
                     try {
                         set.contains(1, 1);
                     } catch (Exception e) {
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 8ff00a022b3..48a1a705a32 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
@@ -243,7 +243,7 @@ public class ConcurrentOpenHashMapTest {
                 } catch (Exception e) {
                     throw new RuntimeException(e);
                 }
-                while (true) {
+                while (!Thread.currentThread().isInterrupted()) {
                     try {
                         map.get("k2");
                     } catch (Exception e) {
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 29722ed7821..d509002e219 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
@@ -214,7 +214,7 @@ public class ConcurrentOpenHashSetTest {
                 } catch (Exception e) {
                     throw new RuntimeException(e);
                 }
-                while (true) {
+                while (!Thread.currentThread().isInterrupted()) {
                     try {
                         set.contains("k2");
                     } catch (Exception e) {