Skip to content

Commit 518bf44

Browse files
authored
Retry at okhttp native Socket closed exception (#364)
1 parent 125f90d commit 518bf44

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/com/treasuredata/client/TDRequestErrorHandler.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.text.SimpleDateFormat;
2525
import java.util.Date;
2626
import java.util.Map;
27+
import java.util.Objects;
2728
import java.util.Optional;
2829
import java.util.concurrent.TimeUnit;
2930
import java.util.concurrent.TimeoutException;
@@ -181,6 +182,10 @@ else if (e instanceof SocketException) {
181182
// All known SocketException are retryable.
182183
return new TDClientSocketException(socketException);
183184
}
185+
else if (Objects.equals(socketException.getMessage(), "Socket closed")) {
186+
// okhttp can raise java.net.SocketException("Socket closed")
187+
return new TDClientSocketException(socketException);
188+
}
184189
else {
185190
// Other unknown SocketException are considered non-retryable.
186191
throw new TDClientSocketException(socketException);

0 commit comments

Comments
 (0)