On Thu, 2016-11-10 at 11:31 +0100, Joan Balagueró - ventusproxy wrote:
> Hello,
>
> We have replaced the httpclient by the async client in our application.
> Everything works fine, but the ‘NoHttpResponseException’ has disappeared
> from our error statistics reports. So, or with the new async pool this error
> does not occur for some reason (that I don’t know) or we are not catching
> this error correctly (more likely).
Async HC does not throw this exception. It is specific to the classic
(blocking) HC.
Oleg
>
> We are using an ‘HttpAsyncResponseConsumer’ and overwriting the
> ‘responseReceived’, ‘consumeContent’ and ‘failed’ methods. We
> understand that when a ‘NoHttpResponseException’ occurs,
> ‘responseReceived’ and ‘consumeContent’ are not called, and the
> ‘failed’ method is the only one that is directly called.
>
> Our ‘failed’ method looks like this:
>
> @Override
> public void failed(final Exception e)
> {
> ProxyServletException pse = null;
>
> if (e.getClass() == java.net.SocketTimeoutException.class) pse = new
> ProxyServletException(ErrorConstants.HTTP_RESPONSE_TIMEOUT, e);
> else if (e.getClass() == java.net.ConnectException.class) pse = new
> ProxyServletException(ErrorConstants.HTTP_CONNECT_TIMEOUT, e);
> else if (e.getClass() == org.apache.http.NoHttpResponseException.class)
> pse = new ProxyServletException(ErrorConstants.HTTP_NO_RESPONSE, e); ←
> the error is caugth here
> else if (e.getClass() == java.io.IOException.class) pse = new
> ProxyServletException(ErrorConstants.HTTP_GENERIC_HTTP, e);
> else if (e.getClass() ==
> com.ventusproxy.proxy.servlet.ProxyServletException.class) pse =
> (ProxyServletException)e;
> else if (e.getClass() ==
> org.apache.http.conn.ConnectionPoolTimeoutException.class) pse = new
> ProxyServletException(ErrorConstants.HTTP_MAX_CONNECTIONS, e);
> else if (e.getClass() == java.util.concurrent.TimeoutException.class) pse
> = new ProxyServletException(ErrorConstants.HTTP_MAX_CONNECTIONS, e);
>
> pse = (pse != null ? pse : new
> ProxyServletException(ErrorConstants.HTTP_GENERIC_HTTP, e));
>
> ( . . . )
> }
>
>
> Is this ok? Or I'm missing something?
>
> Thanks,
>
> Joan.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]