Skip to content

Commit a8c60c7

Browse files
committed
fix
1 parent 7b87283 commit a8c60c7

File tree

1 file changed

+7
-5
lines changed
  • ratis-common/src/main/java/org/apache/ratis/util

1 file changed

+7
-5
lines changed

ratis-common/src/main/java/org/apache/ratis/util/IOUtils.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,14 @@ static <T> T getFromFuture(CompletableFuture<T> future, Supplier<Object> name, T
101101
}
102102

103103
static boolean shouldReconnect(Throwable e) {
104-
if (e == null) return false;
105-
if (ReflectionUtils.isInstance(e, NETWORK_EXCEPTIONS)) {
106-
return true;
104+
for (; e != null; e = e.getCause()) {
105+
if (ReflectionUtils.isInstance(e,
106+
SocketException.class, SocketTimeoutException.class, ClosedChannelException.class, EOFException.class,
107+
AlreadyClosedException.class, TimeoutIOException.class)) {
108+
return true;
109+
}
107110
}
108-
return e.getCause() != null &&
109-
ReflectionUtils.isInstance(e.getCause(), NETWORK_EXCEPTIONS);
111+
return false;
110112
}
111113

112114
static void readFully(InputStream in, int buffSize) throws IOException {

0 commit comments

Comments
 (0)