Improved logging and toString() implementations.

This commit is contained in:
Simone Bordet 2013-10-22 19:17:35 +02:00
parent 8d9fd6ad71
commit 1df50f86f9
4 changed files with 22 additions and 5 deletions

View File

@ -73,4 +73,10 @@ public abstract class HttpChannel
{ {
disassociate(); disassociate();
} }
@Override
public String toString()
{
return String.format("%s@%h", getClass().getSimpleName(), this);
}
} }

View File

@ -148,4 +148,10 @@ public abstract class HttpConnection implements Connection
authnResult.apply(request); authnResult.apply(request);
} }
} }
@Override
public String toString()
{
return String.format("%s@%h", getClass().getSimpleName(), this);
}
} }

View File

@ -94,7 +94,7 @@ public abstract class MultiplexHttpDestination<C extends Connection> extends Htt
{ {
HttpClient client = getHttpClient(); HttpClient client = getHttpClient();
final HttpExchange exchange = getHttpExchanges().poll(); final HttpExchange exchange = getHttpExchanges().poll();
LOG.debug("Processing exchange {} on connection {}", exchange, connection); LOG.debug("Processing {} on {}", exchange, connection);
if (exchange == null) if (exchange == null)
return false; return false;
@ -130,7 +130,6 @@ public abstract class MultiplexHttpDestination<C extends Connection> extends Htt
public void close(Connection connection) public void close(Connection connection)
{ {
super.close(connection); super.close(connection);
assert this.connection == connection;
while (true) while (true)
{ {
ConnectState current = connect.get(); ConnectState current = connect.get();

View File

@ -136,9 +136,9 @@ public class HttpConnectionOverHTTP extends AbstractConnection implements Connec
@Override @Override
public String toString() public String toString()
{ {
return String.format("%s@%x(l:%s <-> r:%s)", return String.format("%s@%h(l:%s <-> r:%s)",
HttpConnection.class.getSimpleName(), getClass().getSimpleName(),
hashCode(), this,
getEndPoint().getLocalAddress(), getEndPoint().getLocalAddress(),
getEndPoint().getRemoteAddress()); getEndPoint().getRemoteAddress());
} }
@ -171,5 +171,11 @@ public class HttpConnectionOverHTTP extends AbstractConnection implements Connec
{ {
HttpConnectionOverHTTP.this.close(); HttpConnectionOverHTTP.this.close();
} }
@Override
public String toString()
{
return HttpConnectionOverHTTP.this.toString();
}
} }
} }