[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
msurtani at jboss.com
Wed Jan 10 06:32:41 EST 2007
User: msurtani
Date: 07/01/10 06:32:41
Modified: src/org/jboss/cache CacheImpl.java UnversionedNode.java
Log:
optimised UnversionedNode synchronisation, fixed a notification bug and added an optimisation in copying maps in Notifier
Revision Changes Path
1.22 +2 -2 JBossCache/src/org/jboss/cache/CacheImpl.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheImpl.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/CacheImpl.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- CacheImpl.java 10 Jan 2007 03:55:40 -0000 1.21
+++ CacheImpl.java 10 Jan 2007 11:32:39 -0000 1.22
@@ -99,7 +99,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: CacheImpl.java,v 1.21 2007/01/10 03:55:40 msurtani Exp $
+ * @version $Id: CacheImpl.java,v 1.22 2007/01/10 11:32:39 msurtani Exp $
* <p/>
* @see <a href="http://labs.jboss.com/portal/jbosscache/docs">JBossCache doc</a>
*/
@@ -2204,7 +2204,7 @@
if (erase_contents) n.clearDataDirect();
n.putDirect(data);
- notifier.notifyNodeModified(fqn, false, CacheListener.ModificationType.PUT_MAP, rawData, true);
+ notifier.notifyNodeModified(fqn, false, CacheListener.ModificationType.PUT_MAP, n.getDataDirect(), true);
}
1.16 +19 -18 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.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- UnversionedNode.java 10 Jan 2007 03:55:40 -0000 1.15
+++ UnversionedNode.java 10 Jan 2007 11:32:41 -0000 1.16
@@ -23,7 +23,6 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
/**
* Basic data node class.
@@ -154,12 +153,14 @@
{
if (getFqn().isRoot())
{
- children = new ConcurrentHashMap<Object, Node>(64, .5f, 16);
+ //children = new ConcurrentHashMap<Object, Node>(64, .5f, 16);
+ children = new HashMap<Object, Node>(64, .5f);
}
else
{
// Less segments to save memory
- children = new ConcurrentHashMap<Object, Node>(4, .75f, 4);
+// children = new ConcurrentHashMap<Object, Node>(4, .75f, 4);
+ children = new HashMap<Object, Node>(4, .75f);
}
}
return children;
@@ -198,7 +199,7 @@
return cache.get(getFqn(), key);
}
- public synchronized Object getDirect(Object key)
+ public Object getDirect(Object key)
{
return data == null ? null : data.get(key);
}
@@ -231,7 +232,7 @@
return Collections.unmodifiableMap(dMap);
}
- public synchronized Map<Object, Object> getDataDirect()
+ public Map<Object, Object> getDataDirect()
{
return new MapCopy(data);
}
@@ -242,7 +243,7 @@
return cache.put(getFqn(), key, value);
}
- public synchronized Object putDirect(Object key, Object value)
+ public Object putDirect(Object key, Object value)
{
return data.put(key, value);
}
@@ -252,7 +253,7 @@
return getOrCreateChild(child_name, gtx, true);
}
- private synchronized NodeSPI getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean createIfNotExists)
+ private NodeSPI getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean createIfNotExists)
{
NodeSPI child;
@@ -313,7 +314,7 @@
return cache.remove(getFqn(), key);
}
- public synchronized Object removeDirect(Object key)
+ public Object removeDirect(Object key)
{
if (data == null) return null;
return data.remove(key);
@@ -392,7 +393,7 @@
cache.removeData(getFqn());
}
- public synchronized void clearDataDirect()
+ public void clearDataDirect()
{
if (data != null) data.clear();
}
@@ -437,7 +438,7 @@
return keys == null ? Collections.emptySet() : Collections.unmodifiableSet(keys);
}
- public synchronized Set<Object> getKeysDirect()
+ public Set<Object> getKeysDirect()
{
if (data == null)
{
@@ -471,7 +472,7 @@
removeChild(new Fqn(getFqn(), childName));
}
- public synchronized void removeChildDirect(Object childName)
+ public void removeChildDirect(Object childName)
{
children().remove(childName);
}
@@ -489,12 +490,12 @@
}
}
- public synchronized Map<Object, Node> getChildrenMapDirect()
+ public Map<Object, Node> getChildrenMapDirect()
{
return new MapCopy(children());
}
- public synchronized void setChildrenMapDirect(Map<Object, Node> children)
+ public void setChildrenMapDirect(Map<Object, Node> children)
{
this.children().clear();
this.children.putAll(children);
@@ -505,13 +506,13 @@
cache.put(fqn, data);
}
- public synchronized void putDirect(Map data)
+ public void putDirect(Map data)
{
if (data == null) return;
this.data.putAll(data);
}
- public synchronized void removeChildrenDirect()
+ public void removeChildrenDirect()
{
if (children != null)
{
@@ -608,7 +609,7 @@
return cache.get(new Fqn(getFqn(), childName));
}
- public synchronized NodeSPI getChildDirect(Object childName)
+ public NodeSPI getChildDirect(Object childName)
{
if (childName == null) return null;
return (NodeSPI) (children == null ? null : children.get(childName));
@@ -626,7 +627,7 @@
return Collections.unmodifiableSet(children);
}
- public synchronized Set<NodeSPI> getChildrenDirect()
+ public Set<NodeSPI> getChildrenDirect()
{
// strip out deleted child nodes...
if (children == null || children.size() == 0) return Collections.emptySet();
@@ -640,7 +641,7 @@
return Collections.unmodifiableSet(exclDeleted);
}
- public synchronized Set<NodeSPI> getChildrenDirect(boolean includeMarkedForRemoval)
+ public Set<NodeSPI> getChildrenDirect(boolean includeMarkedForRemoval)
{
if (includeMarkedForRemoval)
{
More information about the jboss-cvs-commits
mailing list