[jboss-cvs] JBossCache/src/org/jboss/cache ...
Elias Ross
genman at noderunner.net
Wed Nov 29 17:10:23 EST 2006
User: genman
Date: 06/11/29 17:10:23
Modified: src/org/jboss/cache TreeCache.java NodeImpl.java
Log:
JBCACHE-888 - Remove TreeCache.UNITIALIZED
Revision Changes Path
1.288 +44 -59 JBossCache/src/org/jboss/cache/TreeCache.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TreeCache.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TreeCache.java,v
retrieving revision 1.287
retrieving revision 1.288
diff -u -b -r1.287 -r1.288
--- TreeCache.java 29 Nov 2006 04:42:36 -0000 1.287
+++ TreeCache.java 29 Nov 2006 22:10:23 -0000 1.288
@@ -6,8 +6,6 @@
*/
package org.jboss.cache;
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
-import EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArraySet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.buddyreplication.BuddyGroup;
@@ -83,6 +81,8 @@
import java.util.Map;
import java.util.Set;
import java.util.Vector;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArraySet;
/**
* A tree-like structure that is replicated across several members. Updates are
@@ -94,7 +94,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: TreeCache.java,v 1.287 2006/11/29 04:42:36 msurtani Exp $
+ * @version $Id: TreeCache.java,v 1.288 2006/11/29 22:10:23 genman Exp $
* <p/>
* @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
*/
@@ -110,7 +110,6 @@
* Root DataNode.
*/
protected DataNode root;
-
{
this.rootSpi = new TreeCacheProxyImpl(this);
this.root = NodeFactory.getInstance().createRootDataNode(NodeFactory.NODE_TYPE_TREENODE, this.rootSpi);
@@ -214,17 +213,6 @@
protected ReplicationQueue repl_queue = null;
/**
- * Uninitialized node key.
- */
- static public final Object UNINITIALIZED = new Object()
- {
- public String toString()
- {
- return "UNINITIALIZED";
- }
- };
-
- /**
* Determines whether to use optimistic locking or not. Disabled by default.
*/
protected boolean nodeLockingOptimistic = false;
@@ -1299,8 +1287,6 @@
/**
* Returns the raw data of the node; called externally internally.
- * Note: This may return a Map with the key {@link #UNINITIALIZED}
- * indicating the node was not completely loaded.
*/
public Map _getData(Fqn fqn)
{
@@ -2268,7 +2254,7 @@
tx_table.addUndoOperation(tx, undo_op);
}
- ((DataNode) n).put(data, (boolean) erase_contents);
+ ((DataNode)n).put(data, (boolean)erase_contents);
notifier.notifyNodeModified(fqn, false, rawData);
@@ -2615,8 +2601,7 @@
raw.clear();
if (eviction)
{
- // required by cache loader to subsequently load the element again
- raw.put(UNINITIALIZED, null);
+ n.getNodeSPI().setDataLoaded(false);
}
if (sendNodeEvent)
@@ -2721,7 +2706,7 @@
{
if (log.isTraceEnabled())
{
- log.trace("_addChild(\"" + parent_fqn + "\", \"" + child_name + "\", node=" + childNode + ")");
+ log.trace("_addChild(\"" + parent_fqn +"\", \"" + child_name + "\", node=" + childNode + ")");
}
if (parent_fqn == null || child_name == null || childNode == null)
@@ -2923,7 +2908,7 @@
NodeData data = new NodeData(BuddyManager.getActualFqn(node.getFqn()), node.getData());
list.add(data);
Map<Object, Node> children = node.getNodeSPI().getChildrenMap();
- for (Node childNode : children.values())
+ for (Node childNode: children.values())
{
getNodeData(list, childNode);
}
@@ -3212,7 +3197,7 @@
private void moveFqns(Node node, Fqn newBase)
{
- Fqn newFqn = new Fqn(newBase, ((TreeNode) node).getName());
+ Fqn newFqn = new Fqn(newBase, ((TreeNode)node).getName());
node.getNodeSPI().setFqn(newFqn);
}
1.21 +31 -3 JBossCache/src/org/jboss/cache/NodeImpl.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: NodeImpl.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/NodeImpl.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- NodeImpl.java 27 Nov 2006 16:15:44 -0000 1.20
+++ NodeImpl.java 29 Nov 2006 22:10:23 -0000 1.21
@@ -50,7 +50,12 @@
/**
* True if all children have been loaded. This is set when TreeCache.getChildrenNames() is called.
*/
- private boolean children_loaded = false;
+ private boolean childrenLoaded = false;
+
+ /**
+ * True if data has been loaded from the cache loader.
+ */
+ private boolean dataLoaded = false;
/**
* Lock manager that manages locks to be acquired when accessing the node inside a transaction. Lazy set just in case
@@ -191,12 +196,12 @@
public boolean getChildrenLoaded()
{
- return children_loaded;
+ return childrenLoaded;
}
public void setChildrenLoaded(boolean flag)
{
- children_loaded = flag;
+ childrenLoaded = flag;
}
public synchronized Object get(Object key)
@@ -428,6 +433,7 @@
/**
* Returns a debug string.
*/
+ @Override
public String toString()
{
StringBuffer sb = new StringBuffer();
@@ -802,6 +808,27 @@
}
}
+ /**
+ * Returns true if the data was loaded from the cache loader.
+ */
+ public boolean getDataLoaded()
+ {
+ return dataLoaded;
+ }
+
+ /**
+ * Sets if the data was loaded from the cache loader.
+ */
+ public void setDataLoaded(boolean dataLoaded)
+ {
+ // TODO remove this
+ log.debug("setDataLoaded(" + dataLoaded + ")", new Throwable());
+ if (!dataLoaded && !data().isEmpty())
+ log.warn("data exists, but setDataLoaded(false)", new Throwable());
+
+ this.dataLoaded = dataLoaded;
+ }
+
public NodeSPI getNodeSPI()
{
return this;
@@ -874,6 +901,7 @@
}
// although the map is empty
+ @Override
public void clear()
{
throw new UnsupportedOperationException();
More information about the jboss-cvs-commits
mailing list