This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new d3d661673 [core] Fix the KvQueryTableTest may stuck in loop (#4328)
d3d661673 is described below
commit d3d661673d0867bfddb642df55f566e0aeb7f21e
Author: WenjunMin <[email protected]>
AuthorDate: Wed Oct 16 10:28:35 2024 +0800
[core] Fix the KvQueryTableTest may stuck in loop (#4328)
---
.../paimon/service/network/NetworkClient.java | 41 +++++++++-------------
1 file changed, 17 insertions(+), 24 deletions(-)
diff --git
a/paimon-service/paimon-service-client/src/main/java/org/apache/paimon/service/network/NetworkClient.java
b/paimon-service/paimon-service-client/src/main/java/org/apache/paimon/service/network/NetworkClient.java
index 2a16d53b9..748d1d2f0 100644
---
a/paimon-service/paimon-service-client/src/main/java/org/apache/paimon/service/network/NetworkClient.java
+++
b/paimon-service/paimon-service-client/src/main/java/org/apache/paimon/service/network/NetworkClient.java
@@ -143,30 +143,23 @@ public class NetworkClient<REQ extends MessageBody, RESP
extends MessageBody> {
new IllegalStateException(clientName + " is already shut
down."));
}
- final ServerConnection<REQ, RESP> connection =
- connections.computeIfAbsent(
- serverAddress,
- ignored -> {
- final ServerConnection<REQ, RESP> newConnection =
- ServerConnection.createPendingConnection(
- clientName, messageSerializer,
stats);
- bootstrap
- .connect(serverAddress.getAddress(),
serverAddress.getPort())
- .addListener(
- (ChannelFutureListener)
-
newConnection::establishConnection);
-
- newConnection
- .getCloseFuture()
- .handle(
- (ignoredA, ignoredB) ->
- connections.remove(
- serverAddress,
newConnection));
-
- return newConnection;
- });
-
- return connection.sendRequest(request);
+ ServerConnection<REQ, RESP> serverConnection =
connections.get(serverAddress);
+ if (serverConnection == null) {
+ final ServerConnection<REQ, RESP> newConnection =
+ ServerConnection.createPendingConnection(clientName,
messageSerializer, stats);
+ serverConnection = newConnection;
+ connections.put(serverAddress, newConnection);
+ bootstrap
+ .connect(serverAddress.getAddress(),
serverAddress.getPort())
+ .addListener((ChannelFutureListener)
newConnection::establishConnection);
+
+ newConnection
+ .getCloseFuture()
+ .handle(
+ (ignoredA, ignoredB) ->
+ connections.remove(serverAddress,
newConnection));
+ }
+ return serverConnection.sendRequest(request);
}
/**