[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Manik Surtani
msurtani at jboss.com
Fri Sep 22 12:27:55 EDT 2006
User: msurtani
Date: 06/09/22 12:27:55
Modified: src/org/jboss/cache/interceptors
ActivationInterceptor.java
CacheStoreInterceptor.java
OptimisticNodeInterceptor.java
Log:
- Modification types to Enums.
- Abstracted put(List)
Revision Changes Path
1.37 +3 -3 JBossCache/src/org/jboss/cache/interceptors/ActivationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ActivationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/ActivationInterceptor.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- ActivationInterceptor.java 7 Sep 2006 13:52:28 -0000 1.36
+++ ActivationInterceptor.java 22 Sep 2006 16:27:55 -0000 1.37
@@ -27,7 +27,7 @@
* their attributes have been initialized and their children have been loaded in memory.
*
* @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
- * @version $Id: ActivationInterceptor.java,v 1.36 2006/09/07 13:52:28 msurtani Exp $
+ * @version $Id: ActivationInterceptor.java,v 1.37 2006/09/22 16:27:55 msurtani Exp $
*/
public class ActivationInterceptor extends CacheLoaderInterceptor implements ActivationInterceptorMBean
{
@@ -289,7 +289,7 @@
{
case MethodDeclarations.removeNodeMethodLocal_id:
// just remove it from loader, don't trigger activation processing
- Modification mod = new Modification(Modification.REMOVE_NODE, (Fqn) args[1]);
+ Modification mod = new Modification(Modification.ModificationType.REMOVE_NODE, (Fqn) args[1]);
cache_loader_modifications.add(mod);
break;
case MethodDeclarations.putDataMethodLocal_id:
@@ -337,7 +337,7 @@
private void addRemoveMod(List l, Fqn fqn)
{
- Modification mod = new Modification(Modification.REMOVE_NODE, fqn);
+ Modification mod = new Modification(Modification.ModificationType.REMOVE_NODE, fqn);
l.add(mod);
cache.getNotifier().notifyNodeActivated(fqn, false);
}
1.33 +14 -11 JBossCache/src/org/jboss/cache/interceptors/CacheStoreInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheStoreInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CacheStoreInterceptor.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- CacheStoreInterceptor.java 19 Sep 2006 13:52:33 -0000 1.32
+++ CacheStoreInterceptor.java 22 Sep 2006 16:27:55 -0000 1.33
@@ -1,6 +1,7 @@
package org.jboss.cache.interceptors;
import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
+import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.GlobalTransaction;
@@ -25,7 +26,7 @@
* through the CacheLoader, either after each method call (no TXs), or at TX commit.
*
* @author Bela Ban
- * @version $Id: CacheStoreInterceptor.java,v 1.32 2006/09/19 13:52:33 msurtani Exp $
+ * @version $Id: CacheStoreInterceptor.java,v 1.33 2006/09/22 16:27:55 msurtani Exp $
*/
public class CacheStoreInterceptor extends BaseCacheLoaderInterceptor implements CacheStoreInterceptorMBean
{
@@ -355,9 +356,9 @@
cache_loader_modifications.add(mod);
if (configuration.isUseInterceptorMbeans() && getStatisticsEnabled())
{
- if ((mod.getType() == Modification.PUT_DATA) ||
- (mod.getType() == Modification.PUT_DATA_ERASE) ||
- (mod.getType() == Modification.PUT_KEY_VALUE))
+ if ((mod.getType() == Modification.ModificationType.PUT_DATA) ||
+ (mod.getType() == Modification.ModificationType.PUT_DATA_ERASE) ||
+ (mod.getType() == Modification.ModificationType.PUT_KEY_VALUE))
{
txPuts++;
}
@@ -391,30 +392,32 @@
switch (methodCall.getMethodId())
{
case MethodDeclarations.putDataMethodLocal_id:
- return new Modification(Modification.PUT_DATA,
+ return new Modification(Modification.ModificationType.PUT_DATA,
(Fqn) args[1], // fqn
(Map) args[2]); // data
case MethodDeclarations.putDataEraseMethodLocal_id:
- return new Modification(Modification.PUT_DATA_ERASE,
+ return new Modification(Modification.ModificationType.PUT_DATA_ERASE,
(Fqn) args[1], // fqn
(Map) args[2]); // data
case MethodDeclarations.putKeyValMethodLocal_id:
- return new Modification(Modification.PUT_KEY_VALUE,
+ return new Modification(Modification.ModificationType.PUT_KEY_VALUE,
(Fqn) args[1], // fqn
args[2], // key
args[3]); // value
case MethodDeclarations.removeNodeMethodLocal_id:
- return new Modification(Modification.REMOVE_NODE,
+ return new Modification(Modification.ModificationType.REMOVE_NODE,
(Fqn) args[1]); // fqn
case MethodDeclarations.removeKeyMethodLocal_id:
- return new Modification(Modification.REMOVE_KEY_VALUE,
+ return new Modification(Modification.ModificationType.REMOVE_KEY_VALUE,
(Fqn) args[1], // fqn
args[2]); // key
case MethodDeclarations.removeDataMethodLocal_id:
- return new Modification(Modification.REMOVE_DATA,
+ return new Modification(Modification.ModificationType.REMOVE_DATA,
(Fqn) args[1]); // fqn
+ case MethodDeclarations.moveMethodLocal_id:
+ return new Modification(Modification.ModificationType.MOVE, (Fqn) args[0], (Fqn) args[1]);
default :
- throw new Exception("method call " + method.getName() + " cannot be converted to a modification");
+ throw new CacheException("method call " + method.getName() + " cannot be converted to a modification");
}
}
}
1.30 +15 -7 JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticNodeInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- OptimisticNodeInterceptor.java 20 Sep 2006 16:28:57 -0000 1.29
+++ OptimisticNodeInterceptor.java 22 Sep 2006 16:27:55 -0000 1.30
@@ -73,6 +73,8 @@
// now that we have all we need in the workspace, perform the move.
doMove(parent, node, workspace);
+
+ addToModificationList(gtx, m);
}
else if (MethodDeclarations.isCrudMethod(m.getMethodId()))
{
@@ -127,13 +129,7 @@
break;
}
- Option opt = ctx.getOptionOverrides();
- if (opt == null || !opt.isCacheModeLocal())
- {
- txTable.addModification(gtx, m);
- if (log.isDebugEnabled()) log.debug("Adding Method " + m + " to modification list");
- }
- if (cache.getCacheLoaderManager() != null) txTable.addCacheLoaderModification(gtx, m);
+ addToModificationList(gtx, m);
}
else
{
@@ -163,6 +159,18 @@
return result;
}
+ public void addToModificationList(GlobalTransaction gtx, MethodCall m)
+ {
+ Option opt = cache.getInvocationContext().getOptionOverrides();
+ if (opt == null || !opt.isCacheModeLocal())
+ {
+ txTable.addModification(gtx, m);
+ if (log.isDebugEnabled()) log.debug("Adding Method " + m + " to modification list");
+ }
+ if (cache.getCacheLoaderManager() != null) txTable.addCacheLoaderModification(gtx, m);
+
+ }
+
public void doMove(WorkspaceNode parent, WorkspaceNode node, TransactionWorkspace ws)
{
Fqn nodeFqn = node.getFqn();
More information about the jboss-cvs-commits
mailing list