[jboss-cvs] JBossCache/src/org/jboss/cache ...
Elias Ross
genman at noderunner.net
Fri Dec 8 14:03:56 EST 2006
User: genman
Date: 06/12/08 14:03:56
Modified: src/org/jboss/cache DataNode.java Fqn.java NodeImpl.java
TreeNode.java
Log:
JBCACHE-888 Clean up node interfaces a little more
Revision Changes Path
1.20 +0 -4 JBossCache/src/org/jboss/cache/DataNode.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: DataNode.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/DataNode.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- DataNode.java 20 Nov 2006 03:53:54 -0000 1.19
+++ DataNode.java 8 Dec 2006 19:03:56 -0000 1.20
@@ -6,10 +6,6 @@
*/
package org.jboss.cache;
-import org.jboss.cache.lock.LockingException;
-import org.jboss.cache.lock.NodeLock;
-import org.jboss.cache.lock.TimeoutException;
-
/**
* Represents a DataNode in the cache.
*
1.42 +8 -5 JBossCache/src/org/jboss/cache/Fqn.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Fqn.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/Fqn.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- Fqn.java 20 Nov 2006 03:53:54 -0000 1.41
+++ Fqn.java 8 Dec 2006 19:03:56 -0000 1.42
@@ -9,6 +9,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.optimistic.FqnComparator;
import java.io.Externalizable;
import java.io.IOException;
@@ -41,9 +42,9 @@
* <p/>
* Another way to look at it is that the "/" separarator is only parsed when it form sa part of a String passed in to Fqn.fromString() and not otherwise.
*
- * @version $Revision: 1.41 $
+ * @version $Revision: 1.42 $
*/
-public class Fqn implements Cloneable, Externalizable, Comparable
+public class Fqn implements Cloneable, Externalizable, Comparable<Fqn>
{
/**
@@ -498,9 +499,11 @@
return Collections.unmodifiableList(elements);
}
- public int compareTo(Object o)
+ /**
+ * Compares this Fqn to another using {@link FqnComparator}.
+ */
+ public int compareTo(Fqn fqn)
{
- if (o == null) return 1;
- return toString().compareTo(o.toString());
+ return FqnComparator.INSTANCE.compare(this, fqn);
}
}
\ No newline at end of file
1.22 +19 -40 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.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- NodeImpl.java 29 Nov 2006 22:10:23 -0000 1.21
+++ NodeImpl.java 8 Dec 2006 19:03:56 -0000 1.22
@@ -35,7 +35,7 @@
public class NodeImpl implements DataNode, Node, NodeSPI, Serializable
{
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -8200950905894940931L;
/**
* Default output indent for printing.
@@ -84,6 +84,22 @@
private Map data;
/**
+ * Constructs a new node with an FQN of Root.
+ */
+ public NodeImpl()
+ {
+ this(Fqn.ROOT);
+ }
+
+ /**
+ * Constructs a new node with an FQN.
+ */
+ public NodeImpl(Fqn fqn)
+ {
+ this.fqn = fqn;
+ }
+
+ /**
* Constructs a new node with a name, etc.
*/
public NodeImpl(Object child_name, Fqn fqn, Map data, CacheSPI cache)
@@ -230,30 +246,16 @@
return getKeys();
}
- boolean isReadLocked()
+ private boolean isReadLocked()
{
return lock_ != null && lock_.isReadLocked();
}
- boolean isWriteLocked()
+ private boolean isWriteLocked()
{
return lock_ != null && lock_.isWriteLocked();
}
- public boolean isLocked()
- {
- return isWriteLocked() || isReadLocked();
- }
-
- /**
- * @deprecated Use getLock() instead
- */
- public NodeLock getImmutableLock()
- {
- initLock();
- return lock_;
- }
-
public IdentityLock getLock()
{
initLock();
@@ -269,11 +271,6 @@
return Collections.unmodifiableMap(data);
}
- public synchronized int numAttributes()
- {
- return data != null ? data.size() : 0;
- }
-
public void put(Map data, boolean erase)
{
if (cache.getInvocationContext().getOptionOverrides().isBypassInterceptorChain())
@@ -482,23 +479,6 @@
}
}
- public void releaseForce()
- {
- if (lock_ != null)
- {
- lock_.releaseForce();
- }
- }
-
- public void releaseAllForce()
- {
- for (Node n : children.values())
- {
- ((NodeImpl) n).releaseAllForce();
- }
- releaseForce();
- }
-
public Node addChild(Fqn f)
{
if (log.isTraceEnabled())
@@ -822,7 +802,6 @@
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());
1.29 +1 -16 JBossCache/src/org/jboss/cache/TreeNode.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TreeNode.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/TreeNode.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- TreeNode.java 20 Nov 2006 03:53:54 -0000 1.28
+++ TreeNode.java 8 Dec 2006 19:03:56 -0000 1.29
@@ -6,12 +6,7 @@
*/
package org.jboss.cache;
-import org.jboss.cache.lock.IdentityLock;
-import org.jboss.cache.lock.LockingException;
-import org.jboss.cache.lock.TimeoutException;
-
import java.util.Map;
-import java.util.Set;
/**
* Represents a node in the tree. Has a relative name and a Fqn. Maintains a
@@ -31,7 +26,7 @@
* @author Bela Ban March 25 2003
* @author Ben Wang
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
- * @version $Revision: 1.28 $
+ * @version $Revision: 1.29 $
*/
public interface TreeNode extends Node
@@ -80,14 +75,4 @@
*/
void addChild(Object child_name, Node n);
- // ---- deprecated methods - should use similar meths in DataNode or AbstractNode instead ---
- // ---- these deprecated methods will be removed in JBossCache 1.3. ---
-
- /**
- * Not to be exposed. Internal calls should use impl classes.
- * @see DataNode
- * @deprecated Will be removed in JBossCache 1.3.
- */
- void releaseAllForce();
-
}
More information about the jboss-cvs-commits
mailing list