Author: manik.surtani(a)jboss.com
Date: 2008-04-18 09:06:53 -0400 (Fri, 18 Apr 2008)
New Revision: 5589
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/BaseCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/EvictNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/channel/BlockChannelCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/channel/UnblockChannelCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/GravitateDataCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoteExistsNodeCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/tx/BaseGlobalTransactionCommand.java
core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java
Log:
Added consistent toString impls
Modified: core/trunk/src/main/java/org/jboss/cache/commands/BaseCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/BaseCommand.java 2008-04-18 11:37:42
UTC (rev 5588)
+++ core/trunk/src/main/java/org/jboss/cache/commands/BaseCommand.java 2008-04-18 13:06:53
UTC (rev 5589)
@@ -1,7 +1,5 @@
package org.jboss.cache.commands;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.commands.functional.MarshallableCommand;
import org.jboss.cache.factories.annotations.CacheInjectionMethods;
@@ -16,16 +14,13 @@
public abstract class BaseCommand implements MarshallableCommand
{
protected static final Object[] EMPTY_OBJECT_ARRAY = new Object[]{};
- protected Log log = LogFactory.getLog(getClass());
protected Notifier notifier;
protected CacheSPI spi;
- protected static boolean trace;
@Inject
public void init(Notifier notifier, CacheSPI spi)
{
this.notifier = notifier;
this.spi = spi;
- trace = log.isTraceEnabled();
}
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/EvictNodeCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/EvictNodeCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/EvictNodeCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -40,4 +40,13 @@
{
return VERSIONED_METHOD_ID == id;
}
+
+ @Override
+ public String toString()
+ {
+ return "EvictNodeCommand{" +
+ "fqn=" + fqn +
+ ", dataVersion=" + dataVersion +
+ "}";
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetChildrenNamesCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -60,4 +60,12 @@
{
return METHOD_ID;
}
+
+ @Override
+ public String toString()
+ {
+ return "GetChildrenNamesCommand{" +
+ "fqn=" + fqn +
+ "}";
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetDataMapCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -3,8 +3,8 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.commands.BaseCommand;
import org.jboss.cache.commands.CommandsVisitor;
+import org.jboss.cache.commands.state.BaseCacheDataCommand;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.invocation.CacheData;
@@ -14,7 +14,7 @@
* @author Mircea.Markus(a)jboss.com
* @since 2.2
*/
-public class GetDataMapCommand extends BaseCommand implements CacheDataCommand
+public class GetDataMapCommand extends BaseCacheDataCommand
{
public static final int METHOD_ID = 24;
@@ -49,40 +49,17 @@
return handler.handleGetDataMapCommand(ctx, this);
}
- public Fqn getFqn()
- {
- return fqn;
- }
-
public int getCommandId()
{
return METHOD_ID;
}
- public Object[] getParameters()
+ @Override
+ public String toString()
{
- return new Object[]{fqn};
+ return "GetDataMapCommand{" +
+ "cacheData=" + cacheData +
+ ", fqn=" + fqn +
+ '}';
}
-
- public void setState(int commandId, Object[] args)
- {
- fqn = (Fqn) args[0];
- }
-
- public boolean equals(Object o)
- {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- GetDataMapCommand that = (GetDataMapCommand) o;
-
- if (fqn != null ? !fqn.equals(that.fqn) : that.fqn != null) return false;
-
- return true;
- }
-
- public int hashCode()
- {
- return (fqn != null ? fqn.hashCode() : 0);
- }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeyValueCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -1,5 +1,7 @@
package org.jboss.cache.commands.cachedata;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
@@ -15,16 +17,20 @@
public class GetKeyValueCommand extends BaseCacheDataCommand
{
public static final int METHOD_ID = 26;
+ private static Log log = LogFactory.getLog(GetKeyValueCommand.class);
+ private static boolean trace;
private Object key;
boolean sendNodeEvent;
public GetKeyValueCommand()
{
+ trace = log.isTraceEnabled();
}
public GetKeyValueCommand(Fqn<?> fqn, Object key, boolean sendNodeEvent)
{
+ this();
this.fqn = fqn;
this.key = key;
this.sendNodeEvent = sendNodeEvent;
@@ -112,7 +118,7 @@
return result;
}
-
+ @Override
public String toString()
{
return "GetKeyValueCommand{" +
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetKeysCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -48,4 +48,12 @@
{
return METHOD_ID;
}
+
+ @Override
+ public String toString()
+ {
+ return "GetKeysCommand{" +
+ "fqn=" + fqn +
+ "}";
+ }
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/GetNodeCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -38,4 +38,12 @@
{
return METHOD_ID;
}
+
+ @Override
+ public String toString()
+ {
+ return "GetNodeCommand{" +
+ "fqn=" + fqn +
+ "}";
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/InvalidateCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -1,5 +1,7 @@
package org.jboss.cache.commands.cachedata;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -31,6 +33,8 @@
public class InvalidateCommand extends EvictNodeCommand
{
public static final int METHOD_ID = 47;
+ private static Log log = LogFactory.getLog(InvalidateCommand.class);
+ private static boolean trace;
/* dependencies*/
private boolean isOptimisticLocking;
@@ -39,11 +43,13 @@
public InvalidateCommand()
{
super(null);
+ trace = log.isTraceEnabled();
}
public InvalidateCommand(Fqn fqn)
{
super(fqn);
+ trace = log.isTraceEnabled();
}
@Inject
@@ -168,11 +174,12 @@
return METHOD_ID;
}
+ @Override
public String toString()
{
return "InvalidateCommand{" +
- "dataVersion=" + dataVersion +
- ", fqn=" + fqn +
+ "fqn=" + fqn +
+ ", dataVersion=" + dataVersion +
'}';
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/MoveCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -7,8 +7,6 @@
import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.commands.state.BaseCacheDataCommand;
-import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.transaction.TransactionTable;
/**
* Implements functionality defined by {@link
org.jboss.cache.Cache#move(org.jboss.cache.Fqn, org.jboss.cache.Fqn)}
@@ -20,8 +18,6 @@
{
public static final int METHOD_ID = 36;
- private TransactionTable transactionTable;
-
/* params */
private Fqn to;
@@ -35,12 +31,6 @@
this.to = to;
}
- @Inject
- public void initialize(TransactionTable txTable)
- {
- this.transactionTable = txTable;
- }
-
public Object perform(InvocationContext ctx)
{
_move(fqn, to, false, ctx);
@@ -145,4 +135,13 @@
result = 31 * result + (to != null ? to.hashCode() : 0);
return result;
}
+
+ @Override
+ public String toString()
+ {
+ return "MoveCommand{" +
+ "fqn=" + fqn +
+ "to=" + to +
+ '}';
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutDataMapCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -1,5 +1,7 @@
package org.jboss.cache.commands.cachedata;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
@@ -26,6 +28,9 @@
public static final int VERSIONED_METHOD_ID = 37;
public static final int ERASE_VERSIONED_METHOD_ID = 38;
+ private static Log log = LogFactory.getLog(PutDataMapCommand.class);
+ private static boolean trace;
+
/* dependencies*/
private GlobalTransaction globalTransaction;
@@ -37,10 +42,12 @@
public PutDataMapCommand()
{
+ trace = log.isTraceEnabled();
}
public PutDataMapCommand(GlobalTransaction globalTransaction, Fqn fqn, Map data,
boolean createUndoOps, boolean eraseContents)
{
+ this();
this.globalTransaction = globalTransaction;
this.fqn = fqn;
this.data = data;
@@ -177,7 +184,7 @@
return result;
}
-
+ @Override
public String toString()
{
return "PutDataMapCommand{" +
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/PutKeyValueCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -1,5 +1,7 @@
package org.jboss.cache.commands.cachedata;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -8,11 +10,9 @@
import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.commands.state.BaseDataVersionCommand;
import org.jboss.cache.commands.state.GlobalTransactionCommand;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.TransactionTable;
import java.util.Collections;
import java.util.Map;
@@ -30,8 +30,8 @@
public static final int PUT_FOR_EXT_READ_METHOD_ID = 45;
public static final int PUT_FOR_EXT_READ_VERSIONED_METHOD_ID = 46;
- /* dependencies*/
- private TransactionTable transactionTable;
+ private static Log log = LogFactory.getLog(PutKeyValueCommand.class);
+ private static boolean trace;
/* parametres */
private GlobalTransaction globalTransaction;
@@ -43,10 +43,12 @@
public PutKeyValueCommand()
{
+ trace = log.isTraceEnabled();
}
public PutKeyValueCommand(GlobalTransaction gtx, Fqn fqn, Object key, Object value,
boolean createUndoOps, boolean isPutForExternalRead)
{
+ this();
this.globalTransaction = gtx;
this.fqn = fqn;
this.key = key;
@@ -55,12 +57,6 @@
this.isPutForExternalRead = isPutForExternalRead;
}
- @Inject
- public void initialize(TransactionTable transactionTable)
- {
- this.transactionTable = transactionTable;
- }
-
public Object perform(InvocationContext ctx)
{
if (trace)
@@ -211,4 +207,18 @@
return commandId == PUT_FOR_EXT_READ_VERSIONED_METHOD_ID || commandId ==
VERSIONED_METHOD_ID;
}
+ @Override
+ public String toString()
+ {
+ return "PutKeyValueCommand{" +
+ "fqn=" + fqn +
+ ", dataVersion=" + dataVersion +
+ ", globalTransaction=" + globalTransaction +
+ ", key=" + key +
+ ", value=" + value +
+ ", createUndoOps=" + createUndoOps +
+ ", isPutForExternalRead=" + isPutForExternalRead +
+ ", oldValue=" + oldValue +
+ '}';
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveDataCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -1,5 +1,7 @@
package org.jboss.cache.commands.cachedata;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
@@ -7,11 +9,9 @@
import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.commands.state.BaseDataVersionCommand;
import org.jboss.cache.commands.state.GlobalTransactionCommand;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.TransactionTable;
import java.util.HashMap;
import java.util.Map;
@@ -27,8 +27,8 @@
public static final int METHOD_ID = 7;
public static final int VERSIONED_METHOD_ID = 42;
- /* dependencies*/
- private TransactionTable transactionTable;
+ private static Log log = LogFactory.getLog(RemoveDataCommand.class);
+ private static boolean trace;
/* parameters*/
private GlobalTransaction globalTransaction;
@@ -39,16 +39,12 @@
public RemoveDataCommand()
{
+ trace = log.isTraceEnabled();
}
- @Inject
- public void initialize(TransactionTable transactionTable)
- {
- this.transactionTable = transactionTable;
- }
-
public RemoveDataCommand(GlobalTransaction gtx, Fqn fqn, boolean createUndoops,
boolean sendNodeEvent, boolean eviction)
{
+ this();
this.globalTransaction = gtx;
this.fqn = fqn;
this.createUndoops = createUndoops;
@@ -212,4 +208,18 @@
{
return id == VERSIONED_METHOD_ID;
}
+
+ @Override
+ public String toString()
+ {
+ return "RemoveDataCommand{" +
+ "fqn=" + fqn +
+ ", dataVersion=" + dataVersion +
+ ", globalTransaction=" + globalTransaction +
+ ", createUndoops=" + createUndoops +
+ ", sendNodeEvent=" + sendNodeEvent +
+ ", eviction=" + eviction +
+ ", originalData=" + originalData +
+ '}';
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveKeyCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -1,5 +1,7 @@
package org.jboss.cache.commands.cachedata;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
@@ -7,11 +9,9 @@
import org.jboss.cache.commands.functional.TxCacheCommand;
import org.jboss.cache.commands.state.BaseDataVersionCommand;
import org.jboss.cache.commands.state.GlobalTransactionCommand;
-import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.TransactionTable;
import java.util.Collections;
import java.util.Map;
@@ -27,8 +27,8 @@
public static final int METHOD_ID = 6;
public static final int VERSIONED_METHOD_ID = 41;
- /* dependencies */
- private TransactionTable transactionTable;
+ private static Log log = LogFactory.getLog(RemoveKeyCommand.class);
+ private static boolean trace;
/* parameters */
private GlobalTransaction globalTransaction;
@@ -38,22 +38,18 @@
public RemoveKeyCommand()
{
+ trace = log.isTraceEnabled();
}
public RemoveKeyCommand(GlobalTransaction gtx, Fqn fqn, Object key, boolean
createUndoOps)
{
+ this();
this.globalTransaction = gtx;
this.fqn = fqn;
this.key = key;
this.createUndoOps = createUndoOps;
}
- @Inject
- public void initialize(TransactionTable transactionTable)
- {
- this.transactionTable = transactionTable;
- }
-
public Object perform(InvocationContext ctx)
{
if (trace) log.trace("perform(" + globalTransaction + ",
\"" + fqn + "\", key=" + key + ")");
@@ -164,4 +160,17 @@
{
return id == VERSIONED_METHOD_ID;
}
+
+ @Override
+ public String toString()
+ {
+ return "RemoveKeyCommand{" +
+ "fqn=" + fqn +
+ ", dataVersion=" + dataVersion +
+ ", globalTransaction=" + globalTransaction +
+ ", key=" + key +
+ ", createUndoOps=" + createUndoOps +
+ ", oldValue=" + oldValue +
+ '}';
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/cachedata/RemoveNodeCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -1,5 +1,7 @@
package org.jboss.cache.commands.cachedata;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
@@ -11,7 +13,6 @@
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.transaction.TransactionTable;
/**
* Implements functionality defined by {@link
org.jboss.cache.CacheSPI#removeNode(org.jboss.cache.Fqn)}
@@ -23,9 +24,10 @@
{
public static final int METHOD_ID = 5;
public static final int VERSIONED_METHOD_ID = 40;
+ private static Log log = LogFactory.getLog(RemoveNodeCommand.class);
+ private static boolean trace;
private boolean isOptimistic;
- private TransactionTable transactionTable;
/*parameters*/
private GlobalTransaction globalTransaction;
@@ -37,10 +39,12 @@
public RemoveNodeCommand()
{
+ trace = log.isTraceEnabled();
}
public RemoveNodeCommand(GlobalTransaction globalTransaction, Fqn fqn, boolean
createUndoOps, boolean skipSendingNodeEvents, boolean eviction)
{
+ this();
this.globalTransaction = globalTransaction;
this.fqn = fqn;
this.createUndoOps = createUndoOps;
@@ -49,9 +53,8 @@
}
@Inject
- public void initialize(TransactionTable txTable, Configuration configuration)
+ public void initialize(Configuration configuration)
{
- this.transactionTable = txTable;
this.isOptimistic = configuration.isNodeLockingOptimistic();
}
@@ -248,4 +251,19 @@
{
this.skipSendingNodeEvents = skipSendingNodeEvents;
}
+
+ @Override
+ public String toString()
+ {
+ return "RemoveNodeCommand{" +
+ "fqn=" + fqn +
+ ", dataVersion=" + dataVersion +
+ ", globalTransaction=" + globalTransaction +
+ ", createUndoOps=" + createUndoOps +
+ ", skipSendingNodeEvents=" + skipSendingNodeEvents +
+ ", eviction=" + eviction +
+ ", parentFqn=" + parentFqn +
+ ", targetNode=" + targetNode +
+ '}';
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/channel/BlockChannelCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/channel/BlockChannelCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/channel/BlockChannelCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -44,4 +44,10 @@
{
// no op
}
+
+ @Override
+ public String toString()
+ {
+ return "BlockChannelCommand{}";
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/channel/UnblockChannelCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/channel/UnblockChannelCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/channel/UnblockChannelCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -45,4 +45,10 @@
{
// no op
}
+
+ @Override
+ public String toString()
+ {
+ return "UnblockChannelCommand{}";
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/AnnounceBuddyPoolNameCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -104,4 +104,14 @@
result = 31 * result + (buddyPoolName != null ? buddyPoolName.hashCode() : 0);
return result;
}
+
+ @Override
+ public String toString()
+ {
+ return "AnnounceBuddyPoolNameCommand{" +
+ "buddyManager=" + buddyManager +
+ ", address=" + address +
+ ", buddyPoolName='" + buddyPoolName + '\'' +
+ '}';
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/AssignToBuddyGroupCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -7,6 +7,7 @@
import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.factories.annotations.Inject;
+import java.util.Arrays;
import java.util.Map;
/**
@@ -43,8 +44,6 @@
{
if (buddyManager != null)
buddyManager.handleAssignToBuddyGroup(group, state);
- else if (log.isWarnEnabled())
- log.warn("Received assignToBuddyGroup call from group owner [" +
group.getDataOwner() + "] but buddy replication is not enabled on this node!");
return null;
}
@@ -103,4 +102,14 @@
result = 31 * result + (state != null ? state.hashCode() : 0);
return result;
}
+
+ @Override
+ public String toString()
+ {
+ return "AssignToBuddyGroupCommand{" +
+ "buddyManager=" + buddyManager +
+ ", group=" + group +
+ ", state=" + (state == null ? null : Arrays.asList(state)) +
+ '}';
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/ClusteredGetCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -1,9 +1,10 @@
package org.jboss.cache.commands.remote;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.CommandsVisitor;
import org.jboss.cache.commands.cachedata.CacheDataCommand;
-import org.jboss.cache.commands.remote.RemoteExistsNodeCommand;
import org.jboss.cache.commands.cachedata.GetChildrenNamesCommand;
import org.jboss.cache.commands.cachedata.GetDataMapCommand;
import org.jboss.cache.factories.annotations.Inject;
@@ -27,12 +28,17 @@
private CacheData cacheData;
private InterceptorChain interceptorChain;
+ private static Log log = LogFactory.getLog(ClusteredGetCommand.class);
+ private static boolean trace;
+
public ClusteredGetCommand()
{
+ trace = log.isTraceEnabled();
}
public ClusteredGetCommand(Boolean searchBackupSubtrees, CacheDataCommand
cacheDataComand)
{
+ this();
this.searchBackupSubtrees = searchBackupSubtrees;
this.cacheDataComand = cacheDataComand;
}
@@ -162,4 +168,15 @@
result = 31 * result + (searchBackupSubtrees != null ?
searchBackupSubtrees.hashCode() : 0);
return result;
}
+
+ @Override
+ public String toString()
+ {
+ return "ClusteredGetCommand{" +
+ "cacheDataComand=" + cacheDataComand +
+ ", searchBackupSubtrees=" + searchBackupSubtrees +
+ ", cacheData=" + cacheData +
+ ", interceptorChain=" + interceptorChain +
+ '}';
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/DataGravitationCleanupCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -1,5 +1,7 @@
package org.jboss.cache.commands.remote;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
@@ -12,7 +14,6 @@
import org.jboss.cache.commands.state.BaseCacheDataCommand;
import org.jboss.cache.commands.state.GlobalTransactionCommand;
import org.jboss.cache.factories.annotations.Inject;
-import org.jboss.cache.invocation.CacheData;
import org.jboss.cache.invocation.CacheTransactionHelper;
import org.jboss.cache.invocation.InterceptorChain;
import org.jboss.cache.transaction.GlobalTransaction;
@@ -36,18 +37,22 @@
private CacheTransactionHelper transactionHelper;
private InterceptorChain invoker;
private CommandsFactory commandsFactory;
- private CacheData cacheData;
+ private static Log log = LogFactory.getLog(DataGravitationCleanupCommand.class);
+ private static boolean trace;
+
/* parameters */
private GlobalTransaction globalTransaction;
private Fqn backup;
public DataGravitationCleanupCommand()
{
+ trace = log.isTraceEnabled();
}
public DataGravitationCleanupCommand(Fqn primary, Fqn backup)
{
+ this();
this.fqn = primary;
this.backup = backup;
}
@@ -207,4 +212,17 @@
result = 31 * result + (backup != null ? backup.hashCode() : 0);
return result;
}
+
+ @Override
+ public String toString()
+ {
+ return "DataGravitationCleanupCommand{" +
+ "buddyManager=" + buddyManager +
+ ", transactionHelper=" + transactionHelper +
+ ", invoker=" + invoker +
+ ", commandsFactory=" + commandsFactory +
+ ", globalTransaction=" + globalTransaction +
+ ", backup=" + backup +
+ '}';
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/GravitateDataCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/GravitateDataCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/GravitateDataCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -1,5 +1,7 @@
package org.jboss.cache.commands.remote;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
@@ -35,12 +37,17 @@
/* parametres */
private boolean searchSubtrees;
+ private static Log log = LogFactory.getLog(GravitateDataCommand.class);
+ private static boolean trace;
+
public GravitateDataCommand()
{
+ trace = log.isTraceEnabled();
}
public GravitateDataCommand(Fqn fqn, boolean searchSubtrees)
{
+ this();
this.fqn = fqn;
this.searchSubtrees = searchSubtrees;
}
@@ -201,4 +208,13 @@
result = 31 * result + (searchSubtrees ? 1 : 0);
return result;
}
+
+ @Override
+ public String toString()
+ {
+ return "GravitateDataCommand{" +
+ "rpcManager=" + rpcManager +
+ ", searchSubtrees=" + searchSubtrees +
+ '}';
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoteExistsNodeCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoteExistsNodeCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoteExistsNodeCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -14,7 +14,7 @@
*
* @author Mircea.Markus(a)jboss.com
* @since 2.2
- * todo - this is only used when remote cache calls exists, nut sure it is necessary to
have it as a command
+ * todo - this is only used when remote cache calls exists, nut sure it is
necessary to have it as a command
*/
public class RemoteExistsNodeCommand extends BaseCacheDataCommand
{
@@ -44,4 +44,10 @@
{
return METHOD_ID;
}
+
+ @Override
+ public String toString()
+ {
+ return "RemoteExistsNodeCommand{}";
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/RemoveFromBuddyGroupCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -36,8 +36,6 @@
{
if (buddyManager != null)
buddyManager.handleRemoveFromBuddyGroup(groupName);
- else if (log.isWarnEnabled())
- log.warn("Received removeFromBuddyGroup call for group name [" +
groupName + "] but buddy replication is not enabled on this node!");
return null;
}
@@ -84,4 +82,13 @@
{
return (groupName != null ? groupName.hashCode() : 0);
}
+
+ @Override
+ public String toString()
+ {
+ return "RemoveFromBuddyGroupCommand{" +
+ "buddyManager=" + buddyManager +
+ ", groupName='" + groupName + '\'' +
+ '}';
+ }
}
Modified: core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/remote/ReplicateCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -1,5 +1,7 @@
package org.jboss.cache.commands.remote;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.commands.CacheCommand;
import org.jboss.cache.commands.CommandsVisitor;
@@ -23,6 +25,9 @@
private InterceptorChain invoker;
+ private static Log log = LogFactory.getLog(ReplicateCommand.class);
+ private static boolean trace;
+
/**
* optimisation - rather than constructing a new list each for scenarios where a
single modification needs
* to be replicated rather use this instance.
@@ -32,10 +37,12 @@
public ReplicateCommand()
{
+ trace = log.isTraceEnabled();
}
public ReplicateCommand(List<MarshallableCommand> modifications)
{
+ this();
if (modifications != null && modifications.size() == 1)
{
singleModification = modifications.get(0);
@@ -48,6 +55,7 @@
public ReplicateCommand(MarshallableCommand command)
{
+ this();
this.singleModification = command;
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/tx/BaseGlobalTransactionCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/tx/BaseGlobalTransactionCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/tx/BaseGlobalTransactionCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -64,4 +64,12 @@
{
return (globalTransaction != null ? globalTransaction.hashCode() : 0);
}
+
+ @Override
+ public String toString()
+ {
+ return getClass().getSimpleName() + "{" +
+ "globalTransaction=" + globalTransaction +
+ '}';
+ }
}
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java
===================================================================
---
core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java 2008-04-18
11:37:42 UTC (rev 5588)
+++
core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java 2008-04-18
13:06:53 UTC (rev 5589)
@@ -25,10 +25,6 @@
public OptimisticPrepareCommand(GlobalTransaction gtx, List<? extends
CacheCommand> modifications, Map data, Address address, boolean onePhaseCommit)
{
super(gtx, modifications, address, onePhaseCommit);
- if (log.isTraceEnabled())
- {
- log.trace("Building optimistic prepare command with modification list:
" + modifications);
- }
this.data = data;
}
@@ -86,7 +82,7 @@
result = 31 * result + (data != null ? data.hashCode() : 0);
return result;
}
-
+
@Override
public String toString()
{