[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
msurtani at jboss.com
Tue Jan 2 20:21:37 EST 2007
User: msurtani
Date: 07/01/02 20:21:37
Modified: src/org/jboss/cache CacheImpl.java
Log:
Init of root node changed
Revision Changes Path
1.11 +17 -10 JBossCache/src/org/jboss/cache/CacheImpl.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheImpl.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/CacheImpl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- CacheImpl.java 2 Jan 2007 19:19:05 -0000 1.10
+++ CacheImpl.java 3 Jan 2007 01:21:37 -0000 1.11
@@ -98,7 +98,7 @@
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
* @author Brian Stansberry
* @author Daniel Huang (dhuang at jboss.org)
- * @version $Id: CacheImpl.java,v 1.10 2007/01/02 19:19:05 msurtani Exp $
+ * @version $Id: CacheImpl.java,v 1.11 2007/01/03 01:21:37 msurtani Exp $
* <p/>
* @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
*/
@@ -580,20 +580,27 @@
public void create() throws Exception
{
// initialise the node factory and set this in the runtime.
- NodeFactory nf = new NodeFactory(this);
- configuration.getRuntimeConfig().setNodeFactory(nf);
-
- if (notifier == null) notifier = new Notifier(this);
- stateFetchTimeout = configuration.getLockAcquisitionTimeout() + 5000;
- if (configuration.isNodeLockingOptimistic())
+ NodeFactory nf;
+ if ((nf = configuration.getRuntimeConfig().getNodeFactory()) == null)
{
- root = nf.createRootDataNode();
+ nf = new NodeFactory(this);
+ configuration.getRuntimeConfig().setNodeFactory(nf);
}
else
{
- root = nf.createRootDataNode();
+ // don't create a new one each and every time. After stopping and starting the cache, the old NodeFactory may still be valid.
+ nf.init();
}
+ if (notifier == null) notifier = new Notifier(this);
+ stateFetchTimeout = configuration.getLockAcquisitionTimeout() + 5000;
+
+ // create a new root temporarily.
+ NodeSPI tempRoot = nf.createRootDataNode();
+ // if we don't already have a root or the new (temp) root is of a different class (optimistic vs pessimistic) to
+ // the current root, then we use the new one. Helps preserve data between cache restarts.
+ if (root == null || !root.getClass().equals(tempRoot.getClass())) root = tempRoot;
+
setUseReplQueue(configuration.isUseReplQueue());
setIsolationLevel(configuration.getIsolationLevel());
@@ -1886,7 +1893,7 @@
return 0;
}
int count = 1;// for n
- for (Node child : n.getNodeSPI().getChildrenMap().values())
+ for (Node child : n.getChildren())
{
count += numNodes(child);
}
More information about the jboss-cvs-commits
mailing list