This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push:
new 5ac488fa Fix long wait
5ac488fa is described below
commit 5ac488fae6584bcdfa65388de2b25044d5d6aafb
Author: Albumen Kevin <[email protected]>
AuthorDate: Sun Jul 2 15:42:59 2023 +0800
Fix long wait
---
.../dubbo/samples/test/BlockingServiceIT.java | 27 ++++++++++++++++++----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git
a/99-integration/dubbo-samples-multi-port/src/test/java/org/apache/dubbo/samples/test/BlockingServiceIT.java
b/99-integration/dubbo-samples-multi-port/src/test/java/org/apache/dubbo/samples/test/BlockingServiceIT.java
index cc0e5e8b..788c327f 100644
---
a/99-integration/dubbo-samples-multi-port/src/test/java/org/apache/dubbo/samples/test/BlockingServiceIT.java
+++
b/99-integration/dubbo-samples-multi-port/src/test/java/org/apache/dubbo/samples/test/BlockingServiceIT.java
@@ -30,6 +30,8 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@@ -96,20 +98,31 @@ public class BlockingServiceIT {
Assert.assertEquals("dubbo-danger", blockingServiceD.type());
Assert.assertEquals("dubbo-openapi", blockingServiceE.type());
+ List<Thread> threads = new LinkedList<>();
for (int i = 0; i < 10; i++) {
- new Thread(() -> blockingServiceA.block()).start();
+ Thread t = new Thread(() -> blockingServiceA.block());
+ t.start();
+ threads.add(t);
}
for (int i = 0; i < 11; i++) {
- new Thread(() -> blockingServiceB.block()).start();
+ Thread t = new Thread(() -> blockingServiceB.block());
+ t.start();
+ threads.add(t);
}
for (int i = 0; i < 12; i++) {
- new Thread(() -> blockingServiceC.block()).start();
+ Thread t = new Thread(() -> blockingServiceC.block());
+ t.start();
+ threads.add(t);
}
for (int i = 0; i < 13; i++) {
- new Thread(() -> blockingServiceD.block()).start();
+ Thread t = new Thread(() -> blockingServiceD.block());
+ t.start();
+ threads.add(t);
}
for (int i = 0; i < 14; i++) {
- new Thread(() -> blockingServiceE.block()).start();
+ Thread t = new Thread(() -> blockingServiceE.block());
+ t.start();
+ threads.add(t);
}
await().untilAsserted(() -> {
@@ -158,6 +171,10 @@ public class BlockingServiceIT {
} catch (Exception e) {
Assert.assertTrue(e.getMessage().contains("Thread pool is
EXHAUSTED"));
}
+
+ for (Thread thread : threads) {
+ thread.interrupt();
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]