You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2022/05/12 03:06:51 UTC
[iotdb] branch xingtanzjr/0511_test updated: add more connection cause
This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a commit to branch xingtanzjr/0511_test
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/xingtanzjr/0511_test by this push:
new 3fb413cde1 add more connection cause
3fb413cde1 is described below
commit 3fb413cde17e8392b29413074632078a6fa48a91
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Thu May 12 11:06:41 2022 +0800
add more connection cause
---
.../commons/client/sync/SyncThriftClientWithErrorHandler.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/client/sync/SyncThriftClientWithErrorHandler.java b/node-commons/src/main/java/org/apache/iotdb/commons/client/sync/SyncThriftClientWithErrorHandler.java
index ef1c9643a0..ad586d33bf 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/client/sync/SyncThriftClientWithErrorHandler.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/client/sync/SyncThriftClientWithErrorHandler.java
@@ -23,6 +23,7 @@ import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.thrift.TException;
+import org.apache.thrift.transport.TTransportException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -81,8 +82,7 @@ public class SyncThriftClientWithErrorHandler implements MethodInterceptor {
rootCause.getMessage(),
rootCause.getLocalizedMessage(),
rootCause);
- if (rootCause instanceof SocketException
- && rootCause.getMessage().contains("Broken pipe")) {
+ if (isConnectionBroken(rootCause)) {
LOGGER.error(
"Broken pipe error happened in calling method {}, we need to clear all previous cached connection, err: {}",
method.getName(),
@@ -94,4 +94,10 @@ public class SyncThriftClientWithErrorHandler implements MethodInterceptor {
throw new TException("Error in calling method " + method.getName(), t);
}
}
+
+ private boolean isConnectionBroken(Throwable cause) {
+ return (cause instanceof SocketException && cause.getMessage().contains("Broken pipe"))
+ || cause instanceof TTransportException
+ && cause.getMessage().contains("Socket is closed by peer");
+ }
}