[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...
Manik Surtani
msurtani at jboss.com
Sat Dec 30 12:49:54 EST 2006
User: msurtani
Date: 06/12/30 12:49:54
Modified: src/org/jboss/cache/interceptors
OptimisticNodeInterceptor.java
OptimisticValidatorInterceptor.java
CallInterceptor.java
CreateIfNotExistsInterceptor.java
PessimisticLockInterceptor.java
CacheMgmtInterceptor.java
InvalidationInterceptor.java
OptimisticCreateIfNotExistsInterceptor.java
CacheStoreInterceptor.java
CacheLoaderInterceptor.java
DataGravitatorInterceptor.java TxInterceptor.java
ActivationInterceptor.java
OptimisticLockingInterceptor.java
PassivationInterceptor.java
Log:
Major changes to restructure cache and node object model
Revision Changes Path
1.37 +5 -6 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.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- OptimisticNodeInterceptor.java 14 Dec 2006 17:18:48 -0000 1.36
+++ OptimisticNodeInterceptor.java 30 Dec 2006 17:49:53 -0000 1.37
@@ -11,7 +11,6 @@
import org.jboss.cache.GlobalTransaction;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
-import org.jboss.cache.TreeNode;
import org.jboss.cache.config.Option;
import org.jboss.cache.factories.NodeFactory;
import org.jboss.cache.marshall.MethodCall;
@@ -195,9 +194,9 @@
// now that we have the parent and target nodes:
// first correct the pointers at the pruning point
- oldParent.removeChild(nodeName);
+ oldParent.removeChild(new Fqn(nodeName));
// parent.addChild(nodeName, node);
- // parent.createChild(nodeName, nodeFqn, parent.getNode(), ((TreeCacheProxyImpl)cache).treeCache, null);
+ // parent.createChild(nodeName, nodeFqn, parent.getNode(), ((TreeCacheProxyImpl)cache).cache, null);
// parent pointer is calculated on the fly using Fqns.
@@ -226,7 +225,7 @@
// process children
for (Object n : node.getChildrenNames())
{
- // movedNode.createChild(n, new Fqn(node.getFqn(), n), movedNode.getNode(), ((TreeCacheProxyImpl)cache).treeCache, null);
+ // movedNode.createChild(n, new Fqn(node.getFqn(), n), movedNode.getNode(), ((TreeCacheProxyImpl)cache).cache, null);
WorkspaceNode child = getOrCreateWorkspaceNode(new Fqn(node.getFqn(), n), ws);
moveFqns(child, newFqn, ws);
//movedNode.addChild(n, child);
@@ -307,7 +306,7 @@
throw new CacheException("Unable to find parent node with Fqn " + parentFqn);
}
- parentNode.removeChild(workspaceNode.getName());
+ parentNode.removeChild(new Fqn(workspaceNode.getFqn().getLast()));
workspace.addNode(parentNode);
if (debug) log.debug("added parent node " + parentNode.getFqn() + " to workspace");
Fqn nodeFqn = workspaceNode.getFqn();
@@ -440,7 +439,7 @@
{
return null;// seems to happen quite a bit
}
- workspaceNode = NodeFactory.getInstance().createWorkspaceNode((TreeNode) node, workspace);
+ workspaceNode = NodeFactory.getInstance().createWorkspaceNode(node, workspace);
workspace.addNode(workspaceNode);
}
// the node has been deleted dude!
1.47 +8 -9 JBossCache/src/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticValidatorInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- OptimisticValidatorInterceptor.java 12 Dec 2006 14:51:44 -0000 1.46
+++ OptimisticValidatorInterceptor.java 30 Dec 2006 17:49:53 -0000 1.47
@@ -7,12 +7,11 @@
package org.jboss.cache.interceptors;
import org.jboss.cache.CacheException;
-import org.jboss.cache.DataNode;
import org.jboss.cache.Fqn;
import org.jboss.cache.GlobalTransaction;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
-import org.jboss.cache.OptimisticTreeNode;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.cache.optimistic.DataVersioningException;
@@ -110,8 +109,8 @@
Fqn fqn = workspaceNode.getFqn();
if (trace) log.trace("Validating version for node " + fqn);
- OptimisticTreeNode realNode;
- realNode = (OptimisticTreeNode) cache.peek(fqn);
+ NodeSPI realNode;
+ realNode = cache.peek(fqn);
// if this is a newly created node then we expect the underlying node to be null.
// if not, we have a problem...
@@ -135,13 +134,13 @@
if (realNode.getVersion().newerThan(workspaceNode.getVersion()))
{
// we have an out of date node here
- throw new DataVersioningException("DataNode [" + fqn + "] version " + ((OptimisticTreeNode) workspaceNode.getNode()).getVersion() + " is newer than workspace node " + workspaceNode.getVersion());
+ throw new DataVersioningException("DataNode [" + fqn + "] version " + workspaceNode.getNode().getVersion() + " is newer than workspace node " + workspaceNode.getVersion());
}
}
}
}
- private boolean checkNotInitialRootVersion(OptimisticTreeNode n)
+ private boolean checkNotInitialRootVersion(NodeSPI n)
{
return !n.getFqn().isRoot() || !(n.getVersion() instanceof DefaultDataVersion) || n.getVersion() != DefaultDataVersion.ZERO;
}
@@ -181,12 +180,12 @@
else
{
cache.getNotifier().notifyNodeRemoved(dNode.getFqn(), true, dNode.getNodeSPI().getRawData());
- DataNode parent = (DataNode) dNode.getParent();
+ Node parent = dNode.getParent();
if (parent == null)
{
throw new IllegalStateException("dNode " + dNode + " has no parent");
}
- parent.removeChild(dNode.getFqn().getLast());
+ parent.removeChild(new Fqn(dNode.getFqn().getLast()));
cache.getNotifier().notifyNodeRemoved(dNode.getFqn(), false, null);
}
}
@@ -196,7 +195,7 @@
// if (wrappedNode.hasCreatedOrRemovedChildren() handleChildNodes(wrappedNode);
if (wrappedNode.isDirty())
{
- OptimisticTreeNode current = (OptimisticTreeNode) wrappedNode.getNode();
+ NodeSPI current = wrappedNode.getNode();
Map mergedChildren = wrappedNode.getMergedChildren();
// this could be done better to account for more subtle merges
1.16 +89 -88 JBossCache/src/org/jboss/cache/interceptors/CallInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CallInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CallInterceptor.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- CallInterceptor.java 25 Aug 2006 14:10:07 -0000 1.15
+++ CallInterceptor.java 30 Dec 2006 17:49:53 -0000 1.16
@@ -1,12 +1,12 @@
package org.jboss.cache.interceptors;
+import org.jboss.cache.CacheImpl;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.GlobalTransaction;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.TreeCache;
import org.jboss.cache.config.Option;
-import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.cache.marshall.MethodCall;
+import org.jboss.cache.marshall.MethodDeclarations;
import javax.transaction.Transaction;
@@ -14,25 +14,25 @@
* Always at the end of the chain, directly in front of the cache. Simply calls into the cache using reflection.
* If the call resulted in a modification, add the Modification to the end of the modification list
* keyed by the current transaction.
- *
+ * <p/>
* Although always added to the end of an optimistically locked chain as well, calls should not make it down to
* this interceptor unless it is a call the OptimisticNodeInterceptor knows nothing about.
*
* @author Bela Ban
- * @version $Id: CallInterceptor.java,v 1.15 2006/08/25 14:10:07 msurtani Exp $
+ * @version $Id: CallInterceptor.java,v 1.16 2006/12/30 17:49:53 msurtani Exp $
*/
public class CallInterceptor extends Interceptor
{
- private TreeCache treeCache;
+ private CacheImpl cache;
public void setCache(CacheSPI cache)
{
super.setCache(cache);
}
- public void setTreeCacheInstance(TreeCache c)
+ public void setTreeCacheInstance(CacheImpl c)
{
- treeCache = c;
+ cache = c;
}
public Object invoke(MethodCall m) throws Throwable
@@ -46,7 +46,7 @@
try
{
//retval = super.invoke(m);
- retval = m.invoke(treeCache);
+ retval = m.invoke(cache);
}
catch (Throwable t)
{
@@ -99,7 +99,8 @@
{
cache.getTransactionTable().addModification(gtx, m);
}
- if (cache.getCacheLoaderManager() != null) cache.getTransactionTable().addCacheLoaderModification(gtx, m);
+ if (cache.getCacheLoaderManager() != null)
+ cache.getTransactionTable().addCacheLoaderModification(gtx, m);
}
}
}
1.21 +6 -6 JBossCache/src/org/jboss/cache/interceptors/CreateIfNotExistsInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CreateIfNotExistsInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CreateIfNotExistsInterceptor.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- CreateIfNotExistsInterceptor.java 8 Dec 2006 18:49:17 -0000 1.20
+++ CreateIfNotExistsInterceptor.java 30 Dec 2006 17:49:53 -0000 1.21
@@ -9,16 +9,16 @@
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
-import java.util.concurrent.locks.ReentrantLock;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.concurrent.locks.ReentrantLock;
/**
* Handles putXXX() methods: if the given node doesn't exist, it will be created
* (depending on the create_if_not_exists argument)
*
* @author Bela Ban
- * @version $Id: CreateIfNotExistsInterceptor.java,v 1.20 2006/12/08 18:49:17 genman Exp $
+ * @version $Id: CreateIfNotExistsInterceptor.java,v 1.21 2006/12/30 17:49:53 msurtani Exp $
* @deprecated This code is not used anymore and will be removed in a future unlock
*/
public class CreateIfNotExistsInterceptor extends Interceptor
@@ -69,8 +69,8 @@
// Method meth=m.getMethod();
//
// boolean isPut=putMethods.contains(meth),
-// isRemove=TreeCache.removeNodeMethodLocal.equals(meth),
-// isEvict=TreeCache.evictNodeMethodLocal.equals(meth);
+// isRemove=CacheImpl.removeNodeMethodLocal.equals(meth),
+// isEvict=CacheImpl.evictNodeMethodLocal.equals(meth);
//
// if(isPut || isRemove || isEvict) { // we need to sync put(), remove() and evict() calls
// try {
@@ -129,7 +129,7 @@
{
addFqnToPutList(fqn, put_lock);
findAndBlockOnRemove(fqn, remove_lock);
- if (!cache.hasChild(fqn))
+ if (!cache.getRoot().hasChild(fqn))
{
GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
if (log.isTraceEnabled())
@@ -354,7 +354,7 @@
synchronized (this)
{
int treeNodeSize = fqn.size();
- n = cache;
+ n = cache.getRoot();
for (int i = 0; i < treeNodeSize; i++)
{
child_name = fqn.get(i);
1.39 +13 -13 JBossCache/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PessimisticLockInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/PessimisticLockInterceptor.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- PessimisticLockInterceptor.java 15 Dec 2006 17:30:32 -0000 1.38
+++ PessimisticLockInterceptor.java 30 Dec 2006 17:49:53 -0000 1.39
@@ -6,15 +6,15 @@
*/
package org.jboss.cache.interceptors;
+import org.jboss.cache.CacheImpl;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.DataNode;
import org.jboss.cache.Fqn;
import org.jboss.cache.GlobalTransaction;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.TransactionEntry;
import org.jboss.cache.TransactionTable;
-import org.jboss.cache.TreeCacheProxyImpl;
import org.jboss.cache.lock.IsolationLevel;
import org.jboss.cache.lock.LockingException;
import org.jboss.cache.lock.NodeLock;
@@ -37,7 +37,7 @@
* current method and unlock when the method returns.
*
* @author Bela Ban
- * @version $Id: PessimisticLockInterceptor.java,v 1.38 2006/12/15 17:30:32 msurtani Exp $
+ * @version $Id: PessimisticLockInterceptor.java,v 1.39 2006/12/30 17:49:53 msurtani Exp $
*/
public class PessimisticLockInterceptor extends Interceptor
{
@@ -169,7 +169,7 @@
{
lock(fqn, ctx.getGlobalTransaction(), lock_type, recursive, createIfNotExists, zeroLockTimeout ? 0 : lock_acquisition_timeout, isDeleteOperation);
}
- while (createIfNotExists && !cache.hasChild(fqn));// keep trying until we have the lock (fixes concurrent remove())
+ while (createIfNotExists && !cache.getRoot().hasChild(fqn));// keep trying until we have the lock (fixes concurrent remove())
}
else if (!lockNecessary)
{
@@ -184,7 +184,7 @@
}
Object o = super.invoke(m);
// FIXME this should be done in UnlockInterceptor, but I didn't want
- // to add the removedNodes map to TreeCache
+ // to add the removedNodes map to CacheImpl
if (isDeleteOperation && ctx.getGlobalTransaction() == null)
{
//cache.getRemovedNodesMap().remove(fqn);
@@ -195,7 +195,7 @@
{
lockManager.getLock(n).releaseAll(Thread.currentThread());
}
- ((TreeCacheProxyImpl) cache).realRemove(fqn, true);
+ ((CacheImpl) cache).realRemove(fqn, true);
}
return o;
@@ -252,7 +252,7 @@
lock_type = NodeLock.LockType.NONE;
}
- n = cache;
+ n = cache.getRoot();
treeNodeSize = fqn.size();
for (int i = -1; i < treeNodeSize; i++)
{
@@ -345,12 +345,12 @@
private boolean needToReverseRemove(Node n, TransactionEntry te, NodeLock.LockType lockTypeRequested, boolean isRemoveOperation, boolean createIfNotExists)
{
- return !isRemoveOperation && createIfNotExists && lockTypeRequested == NodeLock.LockType.WRITE && ((DataNode) n).isDeleted() && te.getRemovedNodes().contains(n.getFqn());
+ return !isRemoveOperation && createIfNotExists && lockTypeRequested == NodeLock.LockType.WRITE && ((NodeSPI) n).isDeleted() && te.getRemovedNodes().contains(n.getFqn());
}
private void reverseRemove(Node n)
{
- ((DataNode) n).markAsDeleted(false);
+ ((NodeSPI) n).markAsDeleted(false);
}
private boolean writeLockNeeded(NodeLock.LockType lock_type, int currentNodeIndex, int treeNodeSize, boolean isRemoveOperation, boolean createIfNotExists, Fqn targetFqn, Fqn currentFqn)
@@ -360,7 +360,7 @@
return true;// we're doing a remove and we've reached the PARENT node of the target to be removed.
}
- if (!isTargetNode(currentNodeIndex, treeNodeSize) && !cache.hasChild(new Fqn(currentFqn, targetFqn.get(currentNodeIndex + 1))))
+ if (!isTargetNode(currentNodeIndex, treeNodeSize) && !cache.getRoot().hasChild(new Fqn(currentFqn, targetFqn.get(currentNodeIndex + 1))))
{
return createIfNotExists;// we're at a node in the tree, not yet at the target node, and we need to create the next node. So we need a WL here.
}
@@ -421,7 +421,7 @@
{
int treeNodeSize;
if ((treeNodeSize = fqn.size()) == 0) return;
- Node n = cache;
+ Node n = cache.getRoot();
for (int i = 0; i < treeNodeSize; i++)
{
Object child_name = fqn.get(i);
@@ -473,7 +473,7 @@
// first remove nodes that should be deleted.
Iterator removedNodes = entry.getRemovedNodes().iterator();
- TreeCacheProxyImpl tcpi = (TreeCacheProxyImpl) cache;
+ CacheImpl tcpi = (CacheImpl) cache;
while (removedNodes.hasNext())
{
Fqn f = (Fqn) removedNodes.next();
@@ -521,7 +521,7 @@
Iterator removedNodes = entry.getRemovedNodes().iterator();
- TreeCacheProxyImpl tcpi = (TreeCacheProxyImpl) cache;
+ CacheImpl tcpi = (CacheImpl) cache;
while (removedNodes.hasNext())
{
Fqn f = (Fqn) removedNodes.next();
1.25 +3 -3 JBossCache/src/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheMgmtInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CacheMgmtInterceptor.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- CacheMgmtInterceptor.java 8 Dec 2006 18:49:17 -0000 1.24
+++ CacheMgmtInterceptor.java 30 Dec 2006 17:49:53 -0000 1.25
@@ -43,7 +43,7 @@
* Captures cache management statistics
*
* @author Jerry Gauthier
- * @version $Id: CacheMgmtInterceptor.java,v 1.24 2006/12/08 18:49:17 genman Exp $
+ * @version $Id: CacheMgmtInterceptor.java,v 1.25 2006/12/30 17:49:53 msurtani Exp $
*/
public class CacheMgmtInterceptor extends Interceptor implements CacheMgmtInterceptorMBean, NotificationBroadcaster
{
@@ -273,7 +273,7 @@
private synchronized void emitNotifications(boolean emit)
{
- // This method adds and removes the TreeCache listener.
+ // This method adds and removes the CacheImpl listener.
// The m_listeners counter is used to determine whether
// we have any clients who are registered for notifications
// from this mbean. When the count is zero, we don't need to
@@ -338,7 +338,7 @@
emitNotifications(false);
}
- // Handler for TreeCache events
+ // Handler for CacheImpl events
private class CacheMgmtListener implements CacheListener
{
private long seq()
1.29 +1 -1 JBossCache/src/org/jboss/cache/interceptors/InvalidationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: InvalidationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/InvalidationInterceptor.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- InvalidationInterceptor.java 10 Nov 2006 02:48:46 -0000 1.28
+++ InvalidationInterceptor.java 30 Dec 2006 17:49:53 -0000 1.29
@@ -31,7 +31,7 @@
/**
* This interceptor acts as a replacement to the replication interceptor when
- * the TreeCache is configured with ClusteredSyncMode as INVALIDATE.
+ * the CacheImpl is configured with ClusteredSyncMode as INVALIDATE.
* <p/>
* The idea is that rather than replicating changes to all caches in a cluster
* when CRUD (Create, Remove, Update, Delete) methods are called, simply call
1.33 +4 -4 JBossCache/src/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticCreateIfNotExistsInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- OptimisticCreateIfNotExistsInterceptor.java 12 Dec 2006 14:51:44 -0000 1.32
+++ OptimisticCreateIfNotExistsInterceptor.java 30 Dec 2006 17:49:53 -0000 1.33
@@ -40,7 +40,7 @@
Object[] args = m.getArgs();
Fqn fqn = (Fqn) (args != null ? args[1] : null);
- if (!cache.hasChild(fqn))
+ if (!cache.getRoot().hasChild(fqn))
{
createNode(fqn);
}
@@ -60,7 +60,7 @@
fqns.add(newParent);
// peek into Node and get a hold of all child fqns as these need to be in the workspace.
- Node node = cache.getChild(nodeFqn);
+ Node node = cache.getRoot().getChild(nodeFqn);
greedyGetFqns(fqns, node, newParent);
@@ -69,7 +69,7 @@
for (Fqn f : fqns)
{
- if (!cache.hasChild(f)) createNode(f);
+ if (!cache.getRoot().hasChild(f)) createNode(f);
}
}
@@ -149,7 +149,7 @@
if (debug)
log.debug("workspaceNode.getChild(" + childName + ")");
- Node tempchildNode = workspaceNode.getChild(childName);
+ Node tempchildNode = workspaceNode.getChild(new Fqn(childName));
// if (log.isDebugEnabled()) log.debug(" Entered synchronized workspaceNode " + workspaceNode + " access for gtx " + gtx);
1.40 +2 -2 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.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- CacheStoreInterceptor.java 8 Dec 2006 18:49:17 -0000 1.39
+++ CacheStoreInterceptor.java 30 Dec 2006 17:49:54 -0000 1.40
@@ -27,7 +27,7 @@
* through the CacheLoader, either after each method call (no TXs), or at TX commit.
*
* @author Bela Ban
- * @version $Id: CacheStoreInterceptor.java,v 1.39 2006/12/08 18:49:17 genman Exp $
+ * @version $Id: CacheStoreInterceptor.java,v 1.40 2006/12/30 17:49:54 msurtani Exp $
*/
public class CacheStoreInterceptor extends BaseCacheLoaderInterceptor implements CacheStoreInterceptorMBean
{
@@ -258,7 +258,7 @@
private void doMove(Fqn parent, Fqn node) throws Exception
{
Fqn newNodeFqn = new Fqn(parent, node.getLast());
- //NodeImpl n = (NodeImpl) ((TreeCacheProxyImpl) cache).peek(newNodeFqn);
+ //UnversionedNode n = (UnversionedNode) ((TreeCacheProxyImpl) cache).peek(newNodeFqn);
//recursiveMove(n);
// throw new RuntimeException("Implement me!");
1.65 +4 -4 JBossCache/src/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheLoaderInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/CacheLoaderInterceptor.java,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- CacheLoaderInterceptor.java 20 Dec 2006 02:16:24 -0000 1.64
+++ CacheLoaderInterceptor.java 30 Dec 2006 17:49:54 -0000 1.65
@@ -29,7 +29,7 @@
* Loads nodes that don't exist at the time of the call into memory from the CacheLoader
*
* @author Bela Ban
- * @version $Id: CacheLoaderInterceptor.java,v 1.64 2006/12/20 02:16:24 msurtani Exp $
+ * @version $Id: CacheLoaderInterceptor.java,v 1.65 2006/12/30 17:49:54 msurtani Exp $
*/
public class CacheLoaderInterceptor extends BaseCacheLoaderInterceptor implements CacheLoaderInterceptorMBean
{
@@ -373,7 +373,7 @@
int treeNodeSize = fqn.size();
// root node
- Node n = cache;
+ Node n = cache.getRoot();
Node child_node;
Object child_name;
for (int i = 0; i < treeNodeSize && n != null; i++)
@@ -461,7 +461,7 @@
int size = fqn.size();
// root node
- Node n = cache;
+ Node n = cache.getRoot();
for (int i = 0; i < size; i++)
{
Object child_name = fqn.get(i);
@@ -483,7 +483,7 @@
}
else
{
- //child_node = n.createChild(child_name, tmp_fqn, n, TreeCache.UNINITIALIZED, null);
+ //child_node = n.createChild(child_name, tmp_fqn, n, CacheImpl.UNINITIALIZED, null);
child_node = n.addChild(new Fqn(child_name));
child_node.getNodeSPI().setDataLoaded(false);
}
1.31 +9 -11 JBossCache/src/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: DataGravitatorInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/DataGravitatorInterceptor.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- DataGravitatorInterceptor.java 8 Dec 2006 18:49:17 -0000 1.30
+++ DataGravitatorInterceptor.java 30 Dec 2006 17:49:54 -0000 1.31
@@ -10,7 +10,6 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.DataNode;
import org.jboss.cache.Fqn;
import org.jboss.cache.GlobalTransaction;
import org.jboss.cache.InvocationContext;
@@ -29,6 +28,7 @@
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -87,7 +87,7 @@
}
else
{
- if (!cache.hasChild(fqn))
+ if (!cache.getRoot().hasChild(fqn))
{
BackupData data;
@@ -370,7 +370,7 @@
NodeData data = (NodeData) nodes.next();
if (localOnly)
{
- if (!cache.hasChild(data.getFqn()))
+ if (!cache.getRoot().hasChild(data.getFqn()))
{
createNodes(data.getFqn(), data.getAttributes());
}
@@ -386,7 +386,7 @@
{
int treeNodeSize;
if ((treeNodeSize = fqn.size()) == 0) return;
- Node n = cache;
+ Node n = cache.getRoot();
for (int i = 0; i < treeNodeSize; i++)
{
Object child_name = fqn.get(i);
@@ -422,14 +422,12 @@
private boolean localBackupExists(Fqn fqn)
{
- Iterator backupRoots = getBackupRootIterator();
boolean exists = false;
- while (backupRoots.hasNext())
+ for (Node node : getBackupRootCollection())
{
- DataNode node = (DataNode) backupRoots.next();
Fqn newSearchFqn = new Fqn(node.getFqn(), fqn);
- exists = cache.hasChild(newSearchFqn);
+ exists = cache.getRoot().hasChild(newSearchFqn);
if (exists) break;
}
@@ -464,10 +462,10 @@
return data;
}
- private Iterator getBackupRootIterator()
+ private Collection<Node> getBackupRootCollection()
{
Node backupRoot = cache.peek(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
- return backupRoot == null ? Collections.EMPTY_SET.iterator() : backupRoot.getChildren().iterator();
+ return backupRoot == null ? Collections.EMPTY_SET : backupRoot.getChildren();
}
private static class BackupData
1.69 +5 -5 JBossCache/src/org/jboss/cache/interceptors/TxInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TxInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/TxInterceptor.java,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- TxInterceptor.java 21 Dec 2006 02:57:52 -0000 1.68
+++ TxInterceptor.java 30 Dec 2006 17:49:54 -0000 1.69
@@ -78,7 +78,7 @@
{
// first of all deal with tx methods - these are only going to be
// prepare/commit/rollback called by a remote cache, since calling
- // such methods on TreeCache directly would fail.
+ // such methods on CacheImpl directly would fail.
if (MethodDeclarations.isTransactionLifecycleMethod(m.getMethodId()))
{
@@ -409,7 +409,7 @@
success = false;
if (retval instanceof Exception)
{
- throw(Exception) retval;
+ throw (Exception) retval;
}
}
}
@@ -735,7 +735,7 @@
{
cache.getInvocationContext().setTxHasMods(modifications != null && modifications.size() > 0);
// JBCACHE-457
- // MethodCall rollbackMethod = MethodCall(TreeCache.rollbackMethod, new Object[]{gtx, hasMods ? true : false});
+ // MethodCall rollbackMethod = MethodCall(CacheImpl.rollbackMethod, new Object[]{gtx, hasMods ? true : false});
MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod, gtx);
if (log.isTraceEnabled()) {log.trace(" running rollback for " + gtx);}
@@ -768,7 +768,7 @@
// TODO: Manik: one phase commit for opt locking too if using repl-async?
// build the method call
MethodCall prepareMethod;
- // if (cache.getCacheModeInternal() != TreeCache.REPL_ASYNC)
+ // if (cache.getCacheModeInternal() != CacheImpl.REPL_ASYNC)
// {
// running a 2-phase commit.
if (configuration.isNodeLockingOptimistic())
@@ -1066,7 +1066,7 @@
if (result instanceof Throwable)
{
tx.setRollbackOnly();
- throw(Throwable) result;
+ throw (Throwable) result;
}
break;
default:
1.45 +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.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- ActivationInterceptor.java 20 Dec 2006 02:16:24 -0000 1.44
+++ ActivationInterceptor.java 30 Dec 2006 17:49:54 -0000 1.45
@@ -25,7 +25,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.44 2006/12/20 02:16:24 msurtani Exp $
+ * @version $Id: ActivationInterceptor.java,v 1.45 2006/12/30 17:49:54 msurtani Exp $
*/
public class ActivationInterceptor extends CacheLoaderInterceptor implements ActivationInterceptorMBean
{
@@ -151,7 +151,7 @@
log.trace("This is a remove data operation; removing the data from the loader, no activation processing needed.");
loader.removeData(fqn);
}
- else if (cache.hasChild(fqn) && loader.exists(fqn))
+ else if (cache.getRoot().hasChild(fqn) && loader.exists(fqn))
{
// Remove the node from the cache loader if it exists in memory,
// its attributes have been initialized, its children have been loaded,
@@ -301,7 +301,7 @@
// AND it was found in the cache loader (nodeLoaded = true).
// Then notify the listeners that the node has been activated.
Fqn fqn = (Fqn) args[1];
- if (fqn != null && cache.hasChild(fqn) && loader.exists(fqn))
+ if (fqn != null && cache.getRoot().hasChild(fqn) && loader.exists(fqn))
{
Node n = getNode(fqn); // don't load
// node not null and attributes have been loaded?
1.24 +1 -1 JBossCache/src/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticLockingInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- OptimisticLockingInterceptor.java 20 Nov 2006 03:53:54 -0000 1.23
+++ OptimisticLockingInterceptor.java 30 Dec 2006 17:49:54 -0000 1.24
@@ -50,7 +50,7 @@
// bail out if _lock() is being called on the tree cache... this should never be called with o/l enabled.
if (m.getMethodId() == MethodDeclarations.lockMethodLocal_id)
{
- log.warn("OptimisticLockingInterceptor intercepted a call to TreeCache._lock(). " +
+ log.warn("OptimisticLockingInterceptor intercepted a call to CacheImpl._lock(). " +
"This should NEVER be called if optimistic locking is used!! " +
"Not allowing this call to proceed further down the chain.");
return retval;
1.35 +13 -11 JBossCache/src/org/jboss/cache/interceptors/PassivationInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PassivationInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/PassivationInterceptor.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- PassivationInterceptor.java 8 Dec 2006 18:49:17 -0000 1.34
+++ PassivationInterceptor.java 30 Dec 2006 17:49:54 -0000 1.35
@@ -1,6 +1,5 @@
package org.jboss.cache.interceptors;
-import java.util.concurrent.atomic.AtomicLong;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
@@ -10,13 +9,14 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
/**
* Writes evicted nodes back to the store on the way in through the
* CacheLoader, either before each method call (no TXs), or at TX commit.
*
* @author <a href="mailto:{hmesha at novell.com}">{Hany Mesha}</a>
- * @version $Id: PassivationInterceptor.java,v 1.34 2006/12/08 18:49:17 genman Exp $
+ * @version $Id: PassivationInterceptor.java,v 1.35 2006/12/30 17:49:54 msurtani Exp $
*/
public class PassivationInterceptor extends Interceptor implements PassivationInterceptorMBean
{
@@ -109,7 +109,7 @@
{
throw new NodeNotLoadedException();
}
- Node n = cache;
+ Node n = cache.getRoot();
int size = fqn.size();
for (int i = 0; i < size && n != null; i++)
{
@@ -128,7 +128,9 @@
private static class NodeNotLoadedException extends Exception
{
- /** The serialVersionUID */
+ /**
+ * The serialVersionUID
+ */
private static final long serialVersionUID = -4078972305344328905L;
}
}
More information about the jboss-cvs-commits
mailing list