[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
manik at jboss.org
Mon Jun 18 12:23:22 EDT 2007
User: msurtani
Date: 07/06/18 12:23:22
Modified: src/org/jboss/cache UnversionedNode.java
Log:
Reduced synchronisation
Revision Changes Path
1.30 +18 -73 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.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- UnversionedNode.java 8 Jun 2007 15:39:29 -0000 1.29
+++ UnversionedNode.java 18 Jun 2007 16:23:22 -0000 1.30
@@ -170,7 +170,7 @@
return cache.get(getFqn(), key);
}
- public synchronized V getDirect(K key)
+ public V getDirect(K key)
{
return data == null ? null : data.get(key);
}
@@ -203,7 +203,7 @@
return Collections.unmodifiableMap(dMap);
}
- public synchronized Map<K, V> getDataDirect()
+ public Map<K, V> getDataDirect()
{
return new MapCopy<K, V>(data);
}
@@ -213,7 +213,7 @@
return cache.put(getFqn(), key, value);
}
- public synchronized V putDirect(K key, V value)
+ public V putDirect(K key, V value)
{
return data.put(key, value);
}
@@ -223,7 +223,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;
@@ -285,7 +285,7 @@
return cache.remove(getFqn(), key);
}
- public synchronized V removeDirect(K key)
+ public V removeDirect(K key)
{
if (data == null) return null;
return data.remove(key);
@@ -312,10 +312,10 @@
{
sb.append("[ ").append(fqn);
}
- synchronized (this)
- {
if (data != null)
{
+ synchronized (data)
+ {
sb.append(" data=").append(data.keySet());
}
}
@@ -377,7 +377,7 @@
cache.removeData(getFqn());
}
- public synchronized void clearDataDirect()
+ public void clearDataDirect()
{
if (data != null) data.clear();
}
@@ -422,7 +422,7 @@
return (Set<K>) (keys == null ? Collections.emptySet() : Collections.unmodifiableSet(keys));
}
- public synchronized Set<K> getKeysDirect()
+ public Set<K> getKeysDirect()
{
if (data == null)
{
@@ -506,23 +506,16 @@
else
{
NodeSPI child = getChildDirect(f);
- if (child != null)
- {
- return child.getParent().removeChildDirect(f.getLastElement());
- }
- else
- {
- return false;
- }
+ return child != null && child.getParent().removeChildDirect(f.getLastElement());
}
}
- public synchronized Map<Object, Node<K, V>> getChildrenMapDirect()
+ public Map<Object, Node<K, V>> getChildrenMapDirect()
{
- return new MapCopy(children());
+ return new MapCopy<Object, Node<K, V>>(children());
}
- public synchronized void setChildrenMapDirect(Map<Object, Node<K, V>> children)
+ public void setChildrenMapDirect(Map<Object, Node<K, V>> children)
{
this.children().clear();
this.children.putAll(children);
@@ -538,13 +531,13 @@
cache.put(fqn, data, true);
}
- public synchronized void putAllDirect(Map<K, V> data)
+ public void putAllDirect(Map<K, V> data)
{
if (data == null) return;
this.data.putAll(data);
}
- public synchronized void removeChildrenDirect()
+ public void removeChildrenDirect()
{
if (children != null)
{
@@ -641,7 +634,7 @@
return cache.get(new Fqn(getFqn(), childName));
}
- public synchronized NodeSPI<K, V> getChildDirect(Object childName)
+ public NodeSPI<K, V> getChildDirect(Object childName)
{
if (childName == null) return null;
return (NodeSPI<K, V>) (children == null ? null : children.get(childName));
@@ -659,7 +652,7 @@
return Collections.unmodifiableSet(children);
}
- public synchronized Set<NodeSPI<K, V>> getChildrenDirect()
+ public Set<NodeSPI<K, V>> getChildrenDirect()
{
// strip out deleted child nodes...
if (children == null || children.size() == 0) return Collections.emptySet();
@@ -673,7 +666,7 @@
return Collections.unmodifiableSet(exclDeleted);
}
- public synchronized Set<NodeSPI<K, V>> getChildrenDirect(boolean includeMarkedForRemoval)
+ public Set<NodeSPI<K, V>> getChildrenDirect(boolean includeMarkedForRemoval)
{
if (includeMarkedForRemoval)
{
@@ -774,53 +767,5 @@
}
return Collections.unmodifiableSet(new HashSet(children.keySet()));
}
-
- }
-
- /*
- private class ChildrenNodes<T> extends AbstractSet
- {
- private boolean includeDeleted;
-
- public ChildrenNodes(boolean includeDeleted)
- {
- this.includeDeleted = includeDeleted;
- }
-
- @Override
- public boolean contains(Object o)
- {
- return children != null && children.containsValue(o);
}
-
- @Override
- public Iterator iterator()
- {
- if (children == null)
- {
- return Collections.emptySet().iterator();
- }
- return children.values().iterator();
- }
-
- // although the map is empty
- @Override
- public void clear()
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int size()
- {
- if (children == null)
- {
- return 0;
- }
- return children.size();
- }
-
- }
- */
-
}
More information about the jboss-cvs-commits
mailing list