Removed unused field in ResponseNotifier.

Catching Throwable in RequestNotifier and ResponseNotifier when
notifying listeners.
This commit is contained in:
Simone Bordet 2014-03-20 22:44:19 +01:00
parent a55ae9e58c
commit 5c0aae2f12
6 changed files with 18 additions and 24 deletions

View File

@ -50,7 +50,7 @@ public abstract class AuthenticationProtocolHandler implements ProtocolHandler
{ {
this.client = client; this.client = client;
this.maxContentLength = maxContentLength; this.maxContentLength = maxContentLength;
this.notifier = new ResponseNotifier(client); this.notifier = new ResponseNotifier();
} }
protected HttpClient getHttpClient() protected HttpClient getHttpClient()

View File

@ -37,7 +37,7 @@ public class ContinueProtocolHandler implements ProtocolHandler
public ContinueProtocolHandler(HttpClient client) public ContinueProtocolHandler(HttpClient client)
{ {
this.client = client; this.client = client;
this.notifier = new ResponseNotifier(client); this.notifier = new ResponseNotifier();
} }
@Override @Override

View File

@ -61,7 +61,7 @@ public abstract class HttpDestination implements Destination, Closeable, Dumpabl
this.exchanges = new BlockingArrayQueue<>(client.getMaxRequestsQueuedPerDestination()); this.exchanges = new BlockingArrayQueue<>(client.getMaxRequestsQueuedPerDestination());
this.requestNotifier = new RequestNotifier(client); this.requestNotifier = new RequestNotifier(client);
this.responseNotifier = new ResponseNotifier(client); this.responseNotifier = new ResponseNotifier();
ProxyConfiguration proxyConfig = client.getProxyConfiguration(); ProxyConfiguration proxyConfig = client.getProxyConfiguration();
proxy = proxyConfig.match(origin); proxy = proxyConfig.match(origin);

View File

@ -76,7 +76,7 @@ public class HttpRedirector
public HttpRedirector(HttpClient client) public HttpRedirector(HttpClient client)
{ {
this.client = client; this.client = client;
this.notifier = new ResponseNotifier(client); this.notifier = new ResponseNotifier();
} }
/** /**

View File

@ -60,7 +60,7 @@ public class RequestNotifier
{ {
listener.onQueued(request); listener.onQueued(request);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
} }
@ -90,7 +90,7 @@ public class RequestNotifier
{ {
listener.onBegin(request); listener.onBegin(request);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
} }
@ -120,7 +120,7 @@ public class RequestNotifier
{ {
listener.onHeaders(request); listener.onHeaders(request);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
} }
@ -150,7 +150,7 @@ public class RequestNotifier
{ {
listener.onCommit(request); listener.onCommit(request);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
} }
@ -192,7 +192,7 @@ public class RequestNotifier
{ {
listener.onContent(request, content); listener.onContent(request, content);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
} }
@ -222,7 +222,7 @@ public class RequestNotifier
{ {
listener.onSuccess(request); listener.onSuccess(request);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
} }
@ -252,7 +252,7 @@ public class RequestNotifier
{ {
listener.onFailure(request, failure); listener.onFailure(request, failure);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
} }

View File

@ -33,12 +33,6 @@ import org.eclipse.jetty.util.log.Logger;
public class ResponseNotifier public class ResponseNotifier
{ {
private static final Logger LOG = Log.getLogger(ResponseNotifier.class); private static final Logger LOG = Log.getLogger(ResponseNotifier.class);
private final HttpClient client;
public ResponseNotifier(HttpClient client)
{
this.client = client;
}
public void notifyBegin(List<Response.ResponseListener> listeners, Response response) public void notifyBegin(List<Response.ResponseListener> listeners, Response response)
{ {
@ -57,7 +51,7 @@ public class ResponseNotifier
{ {
listener.onBegin(response); listener.onBegin(response);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
} }
@ -82,7 +76,7 @@ public class ResponseNotifier
{ {
return listener.onHeader(response, field); return listener.onHeader(response, field);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
return false; return false;
@ -106,7 +100,7 @@ public class ResponseNotifier
{ {
listener.onHeaders(response); listener.onHeaders(response);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
} }
@ -138,7 +132,7 @@ public class ResponseNotifier
{ {
listener.onContent(response, buffer); listener.onContent(response, buffer);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
} }
@ -161,7 +155,7 @@ public class ResponseNotifier
{ {
listener.onSuccess(response); listener.onSuccess(response);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
} }
@ -184,7 +178,7 @@ public class ResponseNotifier
{ {
listener.onFailure(response, failure); listener.onFailure(response, failure);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
} }
@ -207,7 +201,7 @@ public class ResponseNotifier
{ {
listener.onComplete(result); listener.onComplete(result);
} }
catch (Exception x) catch (Throwable x)
{ {
LOG.info("Exception while notifying listener " + listener, x); LOG.info("Exception while notifying listener " + listener, x);
} }