Author: manik.surtani(a)jboss.com
Date: 2008-01-04 12:54:32 -0500 (Fri, 04 Jan 2008)
New Revision: 4990
Modified:
core/branches/1.4.X/src/org/jboss/cache/Node.java
core/branches/1.4.X/src/org/jboss/cache/marshall/JBCMethodCall.java
Log:
Optionally more verbosity in toString() if trace is enabled.
Modified: core/branches/1.4.X/src/org/jboss/cache/Node.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/Node.java 2008-01-04 17:49:20 UTC (rev 4989)
+++ core/branches/1.4.X/src/org/jboss/cache/Node.java 2008-01-04 17:54:32 UTC (rev 4990)
@@ -445,31 +445,40 @@
synchronized (this)
{
if (data != null)
- sb.append("\ndata=[");
- Set keys = data.keySet();
- int i=0;
- for (Iterator it = keys.iterator(); it.hasNext();)
+ {
+ if (trace)
{
- i++;
- sb.append(it.next());
+ sb.append("\ndata=").append(data.keySet());
+ }
+ else
+ {
+ sb.append("\ndata=[");
+ Set keys = data.keySet();
+ int i=0;
+ for (Iterator it = keys.iterator(); it.hasNext();)
+ {
+ i++;
+ sb.append(it.next());
- if (i == 5)
- {
- int more = keys.size() - 5;
- if (more > 1)
+ if (i == 5)
{
- sb.append(", and ");
- sb.append(more);
- sb.append(" more");
- break;
+ int more = keys.size() - 5;
+ if (more > 1)
+ {
+ sb.append(", and ");
+ sb.append(more);
+ sb.append(" more");
+ break;
+ }
}
+ else
+ {
+ sb.append(", ");
+ }
}
- else
- {
- sb.append(", ");
- }
}
- sb.append("]");
+ sb.append("]");
+ }
}
if (lock_ != null)
{
Modified: core/branches/1.4.X/src/org/jboss/cache/marshall/JBCMethodCall.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/marshall/JBCMethodCall.java 2008-01-04
17:49:20 UTC (rev 4989)
+++ core/branches/1.4.X/src/org/jboss/cache/marshall/JBCMethodCall.java 2008-01-04
17:54:32 UTC (rev 4990)
@@ -7,6 +7,7 @@
package org.jboss.cache.marshall;
import org.jgroups.blocks.MethodCall;
+import org.apache.commons.logging.LogFactory;
import java.lang.reflect.Method;
@@ -22,6 +23,7 @@
{
private int methodId;
private static final long serialVersionUID = -4826713878871338199L;
+ private static boolean trace =
LogFactory.getLog(JBCMethodCall.class).isTraceEnabled();
public JBCMethodCall()
{
@@ -61,16 +63,28 @@
public String toString()
{
StringBuffer ret = new StringBuffer();
- boolean first = true;
ret.append(method_name);
ret.append("; id:");
ret.append(methodId);
ret.append("; Args: (");
if (args != null && args.length > 0)
{
- ret.append(" arg[0] = ");
- ret.append(args[0]);
- if (args.length > 1) ret.append(" ...");
+ if (trace)
+ {
+ boolean first = true;
+ for (int i=0; i<args.length; i++)
+ {
+ if (first) first = false;
+ else ret.append(", ");
+ ret.append(args[i]);
+ }
+ }
+ else
+ {
+ ret.append(" arg[0] = ");
+ ret.append(args[0]);
+ if (args.length > 1) ret.append(" ...");
+ }
}
ret.append(')');
return ret.toString();
Show replies by date