[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
msurtani at jboss.com
Wed Jan 10 07:24:56 EST 2007
User: msurtani
Date: 07/01/10 07:24:56
Modified: src/org/jboss/cache UnversionedNode.java
Log:
Reverted synch for alpha2
Revision Changes Path
1.17 +18 -19 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.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- UnversionedNode.java 10 Jan 2007 11:32:41 -0000 1.16
+++ UnversionedNode.java 10 Jan 2007 12:24:56 -0000 1.17
@@ -23,6 +23,7 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
/**
* Basic data node class.
@@ -153,14 +154,12 @@
{
if (getFqn().isRoot())
{
- //children = new ConcurrentHashMap<Object, Node>(64, .5f, 16);
- children = new HashMap<Object, Node>(64, .5f);
+ children = new ConcurrentHashMap<Object, Node>(64, .5f, 16);
}
else
{
// Less segments to save memory
-// children = new ConcurrentHashMap<Object, Node>(4, .75f, 4);
- children = new HashMap<Object, Node>(4, .75f);
+ children = new ConcurrentHashMap<Object, Node>(4, .75f, 4);
}
}
return children;
@@ -199,7 +198,7 @@
return cache.get(getFqn(), key);
}
- public Object getDirect(Object key)
+ public synchronized Object getDirect(Object key)
{
return data == null ? null : data.get(key);
}
@@ -232,7 +231,7 @@
return Collections.unmodifiableMap(dMap);
}
- public Map<Object, Object> getDataDirect()
+ public synchronized Map<Object, Object> getDataDirect()
{
return new MapCopy(data);
}
@@ -243,7 +242,7 @@
return cache.put(getFqn(), key, value);
}
- public Object putDirect(Object key, Object value)
+ public synchronized Object putDirect(Object key, Object value)
{
return data.put(key, value);
}
@@ -253,7 +252,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;
@@ -314,7 +313,7 @@
return cache.remove(getFqn(), key);
}
- public Object removeDirect(Object key)
+ public synchronized Object removeDirect(Object key)
{
if (data == null) return null;
return data.remove(key);
@@ -393,7 +392,7 @@
cache.removeData(getFqn());
}
- public void clearDataDirect()
+ public synchronized void clearDataDirect()
{
if (data != null) data.clear();
}
@@ -438,7 +437,7 @@
return keys == null ? Collections.emptySet() : Collections.unmodifiableSet(keys);
}
- public Set<Object> getKeysDirect()
+ public synchronized Set<Object> getKeysDirect()
{
if (data == null)
{
@@ -472,7 +471,7 @@
removeChild(new Fqn(getFqn(), childName));
}
- public void removeChildDirect(Object childName)
+ public synchronized void removeChildDirect(Object childName)
{
children().remove(childName);
}
@@ -490,12 +489,12 @@
}
}
- public Map<Object, Node> getChildrenMapDirect()
+ public synchronized Map<Object, Node> getChildrenMapDirect()
{
return new MapCopy(children());
}
- public void setChildrenMapDirect(Map<Object, Node> children)
+ public synchronized void setChildrenMapDirect(Map<Object, Node> children)
{
this.children().clear();
this.children.putAll(children);
@@ -506,13 +505,13 @@
cache.put(fqn, data);
}
- public void putDirect(Map data)
+ public synchronized void putDirect(Map data)
{
if (data == null) return;
this.data.putAll(data);
}
- public void removeChildrenDirect()
+ public synchronized void removeChildrenDirect()
{
if (children != null)
{
@@ -609,7 +608,7 @@
return cache.get(new Fqn(getFqn(), childName));
}
- public NodeSPI getChildDirect(Object childName)
+ public synchronized NodeSPI getChildDirect(Object childName)
{
if (childName == null) return null;
return (NodeSPI) (children == null ? null : children.get(childName));
@@ -627,7 +626,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();
@@ -641,7 +640,7 @@
return Collections.unmodifiableSet(exclDeleted);
}
- public Set<NodeSPI> getChildrenDirect(boolean includeMarkedForRemoval)
+ public synchronized Set<NodeSPI> getChildrenDirect(boolean includeMarkedForRemoval)
{
if (includeMarkedForRemoval)
{
More information about the jboss-cvs-commits
mailing list