You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by yu...@apache.org on 2021/06/04 05:16:51 UTC
[thrift] branch master updated: THRIFT-5411: Catch
SocketTimeoutException in TIOStreamTransport read
This is an automated email from the ASF dual-hosted git repository.
yuxuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push:
new be20ad7 THRIFT-5411: Catch SocketTimeoutException in TIOStreamTransport read
be20ad7 is described below
commit be20ad7e08fab200391e3eab41acde9da2a4fd07
Author: David Mollitor <dm...@apache.org>
AuthorDate: Wed May 26 09:26:47 2021 -0400
THRIFT-5411: Catch SocketTimeoutException in TIOStreamTransport read
---
lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java b/lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java
index 763e66a..d5b459c 100644
--- a/lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java
+++ b/lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java
@@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.SocketTimeoutException;
/**
* This is the most commonly used base transport. It takes an InputStream or
@@ -174,6 +175,8 @@ public class TIOStreamTransport extends TEndpointTransport {
int bytesRead;
try {
bytesRead = inputStream_.read(buf, off, len);
+ } catch (SocketTimeoutException ste) {
+ throw new TTransportException(TTransportException.TIMED_OUT, ste);
} catch (IOException iox) {
throw new TTransportException(TTransportException.UNKNOWN, iox);
}