This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.2 by this push:
new 327b808689 Enhance unit test cases in netty4 (#13124)
327b808689 is described below
commit 327b808689ea59a3476bff36e141669609c02eb3
Author: Albumen Kevin <[email protected]>
AuthorDate: Tue Sep 26 09:42:21 2023 +0800
Enhance unit test cases in netty4 (#13124)
---
.../remoting/transport/netty4/ReplierDispatcherTest.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git
a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ReplierDispatcherTest.java
b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ReplierDispatcherTest.java
index bc3f5d8cbb..da8bb1cd61 100644
---
a/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ReplierDispatcherTest.java
+++
b/dubbo-remoting/dubbo-remoting-netty4/src/test/java/org/apache/dubbo/remoting/transport/netty4/ReplierDispatcherTest.java
@@ -28,17 +28,21 @@ import org.apache.dubbo.remoting.exchange.Exchangers;
import org.apache.dubbo.remoting.exchange.support.ReplierDispatcher;
import org.apache.dubbo.rpc.model.ApplicationModel;
import org.apache.dubbo.rpc.model.ModuleModel;
+
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Random;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import static
org.apache.dubbo.common.constants.CommonConstants.EXECUTOR_MANAGEMENT_MODE_DEFAULT;
@@ -99,14 +103,18 @@ class ReplierDispatcherTest {
void testMultiThread() throws Exception {
int tc = 10;
ExecutorService exec = Executors.newFixedThreadPool(tc);
+ List<Future<?>> futureList = new LinkedList<>();
for (int i = 0; i < tc; i++)
- exec.execute(() -> {
+ futureList.add(exec.submit(() -> {
try {
clientExchangeInfo(port);
} catch (Exception e) {
fail();
}
- });
+ }));
+ for (Future<?> future : futureList) {
+ future.get();
+ }
exec.shutdown();
exec.awaitTermination(10, TimeUnit.SECONDS);
}