Author: david.lloyd(a)jboss.com
Date: 2008-07-18 20:28:25 -0400 (Fri, 18 Jul 2008)
New Revision: 4400
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/AbstractAutoCloseable.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteClientEndpointLocalImpl.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteServiceEndpointLocalImpl.java
remoting3/trunk/protocol/basic/src/main/java/org/jboss/cx/remoting/protocol/basic/BasicHandler.java
Log:
Fix logging and toString() to be more readable and useful
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/AbstractAutoCloseable.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/AbstractAutoCloseable.java 2008-07-19
00:16:52 UTC (rev 4399)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/AbstractAutoCloseable.java 2008-07-19
00:28:25 UTC (rev 4400)
@@ -60,7 +60,7 @@
final int v = refcount.decrementAndGet();
if (v == 0) {
// we dropped the refcount to zero
- log.trace("Refcount of %s dropped to zero, closing", this);
+ log.trace("Lowering reference count of %s to 0 (closing)", this);
if (refcount.compareAndSet(0, -65536)) {
// we are closing
close();
@@ -70,7 +70,7 @@
// was already closed; put the count back
refcount.incrementAndGet();
} else {
- log.trace("Clearing reference to %s to %d", this,
Integer.valueOf(v));
+ log.trace("Lowering reference count of %s to %d", this,
Integer.valueOf(v));
}
// otherwise, the resource remains open
}
@@ -82,7 +82,7 @@
*/
protected void inc() throws RemotingException {
final int v = refcount.getAndIncrement();
- log.trace("Adding reference to %s to %d", this, Integer.valueOf(v +
1));
+ log.trace("Raising reference count of %s to %d", this,
Integer.valueOf(v + 1));
if (v < 0) {
// was already closed
refcount.decrementAndGet();
@@ -115,5 +115,13 @@
public T getResource() {
return (T) AbstractAutoCloseable.this;
}
+
+ public String toString() {
+ return "handle to " + String.valueOf(AbstractAutoCloseable.this);
+ }
}
+
+ public String toString() {
+ return "generic resource <" + Integer.toString(hashCode(), 16) +
">";
+ }
}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteClientEndpointLocalImpl.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteClientEndpointLocalImpl.java 2008-07-19
00:16:52 UTC (rev 4399)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteClientEndpointLocalImpl.java 2008-07-19
00:28:25 UTC (rev 4400)
@@ -111,4 +111,8 @@
throw new RemotingException("Failed to open client context", t);
}
}
+
+ public String toString() {
+ return "local client endpoint (request listener = " +
String.valueOf(requestListener) + ")";
+ }
}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteServiceEndpointLocalImpl.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteServiceEndpointLocalImpl.java 2008-07-19
00:16:52 UTC (rev 4399)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteServiceEndpointLocalImpl.java 2008-07-19
00:28:25 UTC (rev 4400)
@@ -80,4 +80,8 @@
ServiceContextImpl getServiceContext() {
return serviceContext;
}
+
+ public String toString() {
+ return "local service endpoint (request listener = " +
String.valueOf(requestListener) + ")";
+ }
}
Modified:
remoting3/trunk/protocol/basic/src/main/java/org/jboss/cx/remoting/protocol/basic/BasicHandler.java
===================================================================
---
remoting3/trunk/protocol/basic/src/main/java/org/jboss/cx/remoting/protocol/basic/BasicHandler.java 2008-07-19
00:16:52 UTC (rev 4399)
+++
remoting3/trunk/protocol/basic/src/main/java/org/jboss/cx/remoting/protocol/basic/BasicHandler.java 2008-07-19
00:28:25 UTC (rev 4400)
@@ -559,6 +559,10 @@
return SpiUtils.getBlankRemoteRequestContext();
}
}
+
+ public String toString() {
+ return "forwarded client endpoint (id = " + identifier +
")";
+ }
}
public final class RemoteRequestContextImpl implements RemoteRequestContext {
@@ -639,5 +643,9 @@
}
}
}
+
+ public String toString() {
+ return "forwarded service endpoint (id = " + identifier +
")";
+ }
}
}