[jbosscache-commits] JBoss Cache SVN: r4841 - core/trunk/src/main/java/org/jboss/cache.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Tue Dec 11 13:17:24 EST 2007
Author: manik.surtani at jboss.com
Date: 2007-12-11 13:17:24 -0500 (Tue, 11 Dec 2007)
New Revision: 4841
Modified:
core/trunk/src/main/java/org/jboss/cache/AbstractNode.java
core/trunk/src/main/java/org/jboss/cache/NodeFactory.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
Log:
AbstractNode and UnversionedNode no longer implement Node and NodeSPI. Only the delegates do this now.
Modified: core/trunk/src/main/java/org/jboss/cache/AbstractNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/AbstractNode.java 2007-12-11 18:09:55 UTC (rev 4840)
+++ core/trunk/src/main/java/org/jboss/cache/AbstractNode.java 2007-12-11 18:17:24 UTC (rev 4841)
@@ -10,7 +10,7 @@
*
* @author manik
*/
-public abstract class AbstractNode<K, V> implements Node<K, V>
+public abstract class AbstractNode<K, V>// implements Node<K, V>
{
protected boolean deleted;
protected Map<Object, Node<K, V>> children;
@@ -34,7 +34,7 @@
{
synchronized (this)
{
- for (Node<?,?> child : children.values())
+ for (Node<?, ?> child : children.values())
{
((AbstractNode) child).markAsDeleted(marker, true);
}
@@ -54,12 +54,11 @@
}
-
public boolean equals(Object another)
{
if (another instanceof AbstractNode)
{
- AbstractNode<?,?> anotherNode = (AbstractNode) another;
+ AbstractNode<?, ?> anotherNode = (AbstractNode) another;
return fqn == null && anotherNode.fqn == null || !(fqn == null || anotherNode.fqn == null) && fqn.equals(anotherNode.fqn);
}
return false;
Modified: core/trunk/src/main/java/org/jboss/cache/NodeFactory.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/NodeFactory.java 2007-12-11 18:09:55 UTC (rev 4840)
+++ core/trunk/src/main/java/org/jboss/cache/NodeFactory.java 2007-12-11 18:17:24 UTC (rev 4841)
@@ -91,6 +91,8 @@
un.setDataLoaded(false);
NodeInvocationDelegate<K, V> nid = new NodeInvocationDelegate(un);
componentRegistry.wireDependencies(nid);
+ // back ref
+ un.setDelegate(nid);
return nid;
}
@@ -103,9 +105,10 @@
{
if (template instanceof WorkspaceNode)
{
- NodeSPI<K, V> dataNodeParent = ((WorkspaceNode<K, V>) parent).getNode();
- TransactionWorkspace workspace = ((WorkspaceNode) template).getTransactionWorkspace();
- return createWorkspaceNode(dataNodeParent, workspace);
+// NodeSPI<K, V> dataNodeParent = ((WorkspaceNode<K, V>) parent).getNode();
+// TransactionWorkspace workspace = ((WorkspaceNode) template).getTransactionWorkspace();
+// return createWorkspaceNode(dataNodeParent, workspace);
+ throw new RuntimeException("DEPRECATED! Use createWorkspaceNode() to create workspace nodes!");
}
// not a workspace node.
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2007-12-11 18:09:55 UTC (rev 4840)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2007-12-11 18:17:24 UTC (rev 4841)
@@ -29,7 +29,7 @@
* @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
* @since 2.0.0
*/
-public class UnversionedNode<K, V> extends AbstractNode<K, V> implements NodeSPI<K, V>
+public class UnversionedNode<K, V> extends AbstractNode<K, V>// implements NodeSPI<K, V>
{
/**
@@ -76,6 +76,8 @@
*/
private boolean valid = true;
+ private NodeSPI delegate;
+
/**
* Constructs a new node with an FQN of Root.
*/
@@ -97,6 +99,16 @@
setInternalState(data);
}
+ public NodeSPI getDelegate()
+ {
+ return delegate;
+ }
+
+ public void setDelegate(NodeSPI delegate)
+ {
+ this.delegate = delegate;
+ }
+
/**
* Initializes with a name and FQN and cache.
*/
@@ -131,7 +143,7 @@
{
if (lock_ == null)
{
- lock_ = new IdentityLock(cache.getConfiguration().getIsolationLevel(), this);
+ lock_ = new IdentityLock(cache.getConfiguration().getIsolationLevel(), delegate);
}
}
@@ -248,7 +260,7 @@
// construct the new child outside the synchronized block to avoid
// spending any more time than necessary in the synchronized section
Fqn child_fqn = new Fqn(this.fqn, child_name);
- NodeSPI<K, V> newChild = (NodeSPI<K, V>) cache.getConfiguration().getRuntimeConfig().getNodeFactory().createNode(child_name, this, null);
+ NodeSPI<K, V> newChild = (NodeSPI<K, V>) cache.getConfiguration().getRuntimeConfig().getNodeFactory().createNode(child_name, delegate, null);
if (newChild == null)
{
throw new IllegalStateException();
@@ -416,7 +428,7 @@
}
else
{
- NodeSPI currentNode = this;
+ NodeSPI currentNode = delegate;
for (int i = 0; i < fqn.size(); i++)
{
Object nextChildName = fqn.get(i);
More information about the jbosscache-commits
mailing list