Skip to content

Commit

Permalink
Retry at okhttp native Socket closed exception
Browse files Browse the repository at this point in the history
  • Loading branch information
miniway committed Dec 18, 2024
1 parent 125f90d commit 6e83d68
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
Expand Down Expand Up @@ -181,6 +182,10 @@ else if (e instanceof SocketException) {
// All known SocketException are retryable.
return new TDClientSocketException(socketException);
}
else if (Objects.equals(socketException.getMessage(), "Socket closed")) {
// okhttp can raise java.net.SocketException("Socket closed")
return new TDClientSocketException(socketException);
}
else {
// Other unknown SocketException are considered non-retryable.
throw new TDClientSocketException(socketException);
Expand Down

0 comments on commit 6e83d68

Please sign in to comment.