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();
}
@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);
}
}
@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();
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<C extends Connection> extends Htt
public void close(Connection connection)
{
super.close(connection);
assert this.connection == connection;
while (true)
{
ConnectState current = connect.get();

View File

@ -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();
}
}
}