[jboss-cvs] JBossCache/src/org/jboss/cache/statetransfer ...
Elias Ross
genman at noderunner.net
Sun Nov 19 22:53:55 EST 2006
User: genman
Date: 06/11/19 22:53:55
Modified: src/org/jboss/cache/statetransfer
DefaultStateTransferGenerator.java
DefaultStateTransferIntegrator.java
StateTransferManager.java
Log:
JBCACHE-867, Move methods from the ProxyImpl to Node, refactor Node classes as well
Revision Changes Path
1.5 +1 -1 JBossCache/src/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: DefaultStateTransferGenerator.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/statetransfer/DefaultStateTransferGenerator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- DefaultStateTransferGenerator.java 22 Sep 2006 18:16:32 -0000 1.4
+++ DefaultStateTransferGenerator.java 20 Nov 2006 03:53:55 -0000 1.5
@@ -131,7 +131,7 @@
out.writeObject(nd);
// then visit the children
- Map children = node.getChildren();
+ Map children = node.getNodeSPI().getChildrenMap();
if (children == null)
return;
for (Iterator it = children.entrySet().iterator(); it.hasNext();)
1.5 +11 -13 JBossCache/src/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: DefaultStateTransferIntegrator.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/statetransfer/DefaultStateTransferIntegrator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- DefaultStateTransferIntegrator.java 22 Sep 2006 18:16:32 -0000 1.4
+++ DefaultStateTransferIntegrator.java 20 Nov 2006 03:53:55 -0000 1.5
@@ -18,6 +18,7 @@
import org.jboss.cache.CacheException;
import org.jboss.cache.DataNode;
import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
import org.jboss.cache.TreeCache;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.factories.NodeFactory;
@@ -99,8 +100,8 @@
{
// Clear any existing state from the targetRoot
log.warn("transient state integration failed, removing all children of " + target);
- target.clear();
- target.removeAllChildren();
+ target.clearData();
+ target.removeChildren();
}
resetClassLoader(oldCL);
@@ -195,20 +196,17 @@
private void notifyAllNodesCreated(DataNode curr)
{
DataNode n;
- Map children;
if (curr == null) return;
getCache().getNotifier().notifyNodeCreated(curr.getFqn(), true);
getCache().getNotifier().notifyNodeCreated(curr.getFqn(), false);
- if ((children = curr.getChildren()) != null)
- {
- for (Iterator it = children.values().iterator(); it.hasNext();)
+ Set children = curr.getChildren();
+ for (Iterator it = children.iterator(); it.hasNext();)
{
n = (DataNode) it.next();
notifyAllNodesCreated(n);
}
}
- }
private ClassLoader setClassLoader(ClassLoader newLoader)
{
@@ -232,7 +230,7 @@
{
Set retainedNodes = retainInternalNodes(target);
- target.removeAllChildren();
+ target.removeChildren();
// Read the first NodeData and integrate into our target
NodeData nd = readNode(in);
@@ -244,7 +242,7 @@
if (attrs != null)
target.put(attrs, true);
else
- target.clear();
+ target.clearData();
// Check whether this is an integration into the buddy backup
// subtree
@@ -299,7 +297,7 @@
// We handle this NodeData. Create a DataNode and
// integrate its data
- DataNode target = factory.createDataNode(nodeType, name, fqn, parent, nd.getAttributes(), true, cache);
+ DataNode target = factory.createDataNode(nodeType, name, fqn, parent, nd.getAttributes(), false, null, cache.getCacheSPI());
parent.addChild(name, target);
// Recursively call, which will walk down the tree
@@ -379,7 +377,7 @@
// Missing level -- have to create empty node
// This shouldn't really happen -- internal fqns should
// be immediately under the root
- child = factory.createDataNode(nodeType, name, new Fqn(ancFqn, name), ancestor, null, true, cache);
+ child = (DataNode) factory.createDataNode(nodeType, name, new Fqn(ancFqn, name), ancestor, null, true, null, cache.getCacheSPI());
ancestor.addChild(name, child);
}
1.15 +7 -5 JBossCache/src/org/jboss/cache/statetransfer/StateTransferManager.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: StateTransferManager.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/statetransfer/StateTransferManager.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- StateTransferManager.java 15 Nov 2006 15:16:40 -0000 1.14
+++ StateTransferManager.java 20 Nov 2006 03:53:55 -0000 1.15
@@ -15,10 +15,12 @@
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.DataNode;
import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
import org.jboss.cache.TreeCache;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.loader.NodeData;
import org.jboss.cache.loader.NodeDataMarker;
+import org.jboss.cache.lock.NodeLock;
import org.jboss.cache.lock.TimeoutException;
import org.jboss.cache.marshall.VersionAwareMarshaller;
import org.jboss.cache.util.ExposedByteArrayOutputStream;
@@ -176,7 +178,7 @@
* Can be <code>null</code>.
* @throws Exception
*/
- public void loadState(Fqn subtreeRoot, DataNode integrationRoot,
+ public void loadState(Fqn subtreeRoot, Node integrationRoot,
Object[] sources, ClassLoader cl)
throws Exception
{
@@ -296,9 +298,9 @@
try
{
if (lockChildren)
- root.acquireAll(lockOwner, timeout, DataNode.LockType.READ);
+ root.getNodeSPI().getLock().acquireAll(lockOwner, timeout, NodeLock.LockType.READ);
else
- root.acquire(lockOwner, timeout, DataNode.LockType.READ);
+ root.getNodeSPI().getLock().acquire(lockOwner, timeout, NodeLock.LockType.READ);
}
catch (TimeoutException te)
{
@@ -330,9 +332,9 @@
try
{
if (childrenLocked)
- root.releaseAll(lockOwner);
+ root.getNodeSPI().getLock().releaseAll(lockOwner);
else
- root.release(lockOwner);
+ root.getNodeSPI().getLock().release(lockOwner);
}
catch (Throwable t)
{
More information about the jboss-cvs-commits
mailing list