[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
msurtani at jboss.com
Thu Jan 4 12:03:54 EST 2007
User: msurtani
Date: 07/01/04 12:03:54
Modified: src/org/jboss/cache AbstractNode.java UnversionedNode.java
Log:
fixed race conditions when adding/removing/evicting children
Revision Changes Path
1.28 +5 -2 JBossCache/src/org/jboss/cache/AbstractNode.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AbstractNode.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/AbstractNode.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- AbstractNode.java 4 Jan 2007 05:35:39 -0000 1.27
+++ AbstractNode.java 4 Jan 2007 17:03:54 -0000 1.28
@@ -31,12 +31,15 @@
deleted = marker;
if (recursive && children != null)
{
+ synchronized (this)
+ {
for (Node child : children.values())
{
((AbstractNode) child).markAsDeleted(marker, true);
}
}
}
+ }
public boolean equals(Object another)
{
1.11 +7 -12 JBossCache/src/org/jboss/cache/UnversionedNode.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UnversionedNode.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/UnversionedNode.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- UnversionedNode.java 4 Jan 2007 14:36:00 -0000 1.10
+++ UnversionedNode.java 4 Jan 2007 17:03:54 -0000 1.11
@@ -263,7 +263,7 @@
return getOrCreateChild(child_name, gtx, true);
}
- private NodeSPI getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean createIfNotExists)
+ private synchronized NodeSPI getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean createIfNotExists)
{
NodeSPI child;
@@ -480,7 +480,7 @@
children().remove(childName);
}
- public synchronized void removeChildDirect(Fqn f)
+ public void removeChildDirect(Fqn f)
{
if (f.size() == 1)
{
@@ -492,12 +492,12 @@
}
}
- public Map<Object, Node> getChildrenMap()
+ public synchronized Map<Object, Node> getChildrenMap()
{
return children();
}
- public void setChildrenMap(Map<Object, Node> children)
+ public synchronized void setChildrenMap(Map<Object, Node> children)
{
this.children = children;
}
@@ -513,7 +513,7 @@
data().putAll(data);
}
- public void removeChildren()
+ public synchronized void removeChildren()
{
if (children != null)
{
@@ -628,7 +628,7 @@
return Collections.unmodifiableSet(children);
}
- public Set<NodeSPI> getChildrenDirect()
+ public synchronized Set<NodeSPI> getChildrenDirect()
{
// strip out deleted child nodes...
if (children == null || children.size() == 0) return Collections.emptySet();
@@ -642,7 +642,7 @@
return Collections.unmodifiableSet(exclDeleted);
}
- public Set<NodeSPI> getChildrenDirect(boolean includeMarkedForRemoval)
+ public synchronized Set<NodeSPI> getChildrenDirect(boolean includeMarkedForRemoval)
{
if (includeMarkedForRemoval)
{
@@ -661,11 +661,6 @@
}
}
- public synchronized Map<Object, Object> getRawData()
- {
- return data();
- }
-
/**
* Returns null or the Map in use with the data.
*/
More information about the jboss-cvs-commits
mailing list