mirror of https://github.com/apache/druid.git
NettyHttpClient: Replace ReadTimeoutException with our own exception. (#12635)
* NettyHttpClient: Replace ReadTimeoutException with our own exception. * Replace exception with same type. * Remove unused import.
This commit is contained in:
parent
6f7fa334fd
commit
ceb4ace118
|
@ -50,6 +50,7 @@ import org.jboss.netty.handler.codec.http.HttpMethod;
|
|||
import org.jboss.netty.handler.codec.http.HttpRequest;
|
||||
import org.jboss.netty.handler.codec.http.HttpResponse;
|
||||
import org.jboss.netty.handler.codec.http.HttpVersion;
|
||||
import org.jboss.netty.handler.timeout.ReadTimeoutException;
|
||||
import org.jboss.netty.handler.timeout.ReadTimeoutHandler;
|
||||
import org.jboss.netty.util.Timer;
|
||||
import org.joda.time.Duration;
|
||||
|
@ -316,7 +317,14 @@ public class NettyHttpClient extends AbstractHttpClient
|
|||
}
|
||||
}
|
||||
|
||||
retVal.setException(event.getCause());
|
||||
if (event.getCause() instanceof ReadTimeoutException) {
|
||||
// ReadTimeoutException thrown by ReadTimeoutHandler is a singleton with a misleading stack trace.
|
||||
// No point including it: instead, we replace it with a fresh exception.
|
||||
retVal.setException(new ReadTimeoutException(StringUtils.format("[%s] Read timed out", requestDesc)));
|
||||
} else {
|
||||
retVal.setException(event.getCause());
|
||||
}
|
||||
|
||||
// response is non-null if we received initial chunk and then exception occurs
|
||||
if (response != null) {
|
||||
handler.exceptionCaught(response, event.getCause());
|
||||
|
|
Loading…
Reference in New Issue