From 1df50f86f946f72c42afff238ed9613145161913 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 22 Oct 2013 19:17:35 +0200 Subject: [PATCH] Improved logging and toString() implementations. --- .../java/org/eclipse/jetty/client/HttpChannel.java | 6 ++++++ .../org/eclipse/jetty/client/HttpConnection.java | 6 ++++++ .../jetty/client/MultiplexHttpDestination.java | 3 +-- .../jetty/client/http/HttpConnectionOverHTTP.java | 12 +++++++++--- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpChannel.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpChannel.java index a87c6ed4b97..94e28e35f19 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpChannel.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpChannel.java @@ -73,4 +73,10 @@ public abstract class HttpChannel { disassociate(); } + + @Override + public String toString() + { + return String.format("%s@%h", getClass().getSimpleName(), this); + } } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java index 1100b777e6e..ff0e250c0dd 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java @@ -148,4 +148,10 @@ public abstract class HttpConnection implements Connection authnResult.apply(request); } } + + @Override + public String toString() + { + return String.format("%s@%h", getClass().getSimpleName(), this); + } } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/MultiplexHttpDestination.java b/jetty-client/src/main/java/org/eclipse/jetty/client/MultiplexHttpDestination.java index 5ab26c72d87..ab563601b19 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/MultiplexHttpDestination.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/MultiplexHttpDestination.java @@ -94,7 +94,7 @@ public abstract class MultiplexHttpDestination extends Htt { HttpClient client = getHttpClient(); final HttpExchange exchange = getHttpExchanges().poll(); - LOG.debug("Processing exchange {} on connection {}", exchange, connection); + LOG.debug("Processing {} on {}", exchange, connection); if (exchange == null) return false; @@ -130,7 +130,6 @@ public abstract class MultiplexHttpDestination extends Htt public void close(Connection connection) { super.close(connection); - assert this.connection == connection; while (true) { ConnectState current = connect.get(); diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpConnectionOverHTTP.java b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpConnectionOverHTTP.java index 19ad11a7b7d..e825e239a8d 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpConnectionOverHTTP.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpConnectionOverHTTP.java @@ -136,9 +136,9 @@ public class HttpConnectionOverHTTP extends AbstractConnection implements Connec @Override public String toString() { - return String.format("%s@%x(l:%s <-> r:%s)", - HttpConnection.class.getSimpleName(), - hashCode(), + return String.format("%s@%h(l:%s <-> r:%s)", + getClass().getSimpleName(), + this, getEndPoint().getLocalAddress(), getEndPoint().getRemoteAddress()); } @@ -171,5 +171,11 @@ public class HttpConnectionOverHTTP extends AbstractConnection implements Connec { HttpConnectionOverHTTP.this.close(); } + + @Override + public String toString() + { + return HttpConnectionOverHTTP.this.toString(); + } } }