[jboss-cvs] JBossCache/src/org/jboss/cache ...
Manik Surtani
manik at jboss.org
Mon Jul 2 06:21:25 EDT 2007
User: msurtani
Date: 07/07/02 06:21:25
Modified: src/org/jboss/cache UnversionedNode.java
Log:
CCL getChindrenNames() to return a Set<Object>
UnversionedNode's getChildrenNames() to return a set impl that can be marshalled efficiently
Revision Changes Path
1.33 +2 -99 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.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- UnversionedNode.java 30 Jun 2007 22:38:40 -0000 1.32
+++ UnversionedNode.java 2 Jul 2007 10:21:25 -0000 1.33
@@ -16,13 +16,9 @@
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.util.MapCopy;
-import java.io.Serializable;
-import java.util.AbstractSet;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -72,8 +68,6 @@
* Map of general data keys to values.
*/
private final Map<K, V> data = new HashMap<K, V>();
- // set reference to a ChildrenNames instance
- private Set<Object> childrenNames;
/**
* Constructs a new node with an FQN of Root.
@@ -416,19 +410,8 @@
public Set<Object> getChildrenNamesDirect()
{
- return childrenNames();
- }
-
- private Set<Object> childrenNames()
- {
- if (childrenNames == null)
- {
- synchronized (this)
- {
- if (childrenNames == null) childrenNames = new ChildrenNames();
- }
- }
- return childrenNames;
+ return children == null ? Collections.emptySet() : new HashSet(children.keySet());
+ //return childrenNames();
}
public Set<K> getKeys()
@@ -744,84 +727,4 @@
{
this.dataLoaded = dataLoaded;
}
-
- private class ChildrenNames extends AbstractSet implements Serializable
- {
-
- /**
- * Since writeReplace() returns a different class, this isn't really necessary.
- */
- private static final long serialVersionUID = 5468697840097489795L;
-
- @Override
- public Iterator iterator()
- {
- if (children == null)
- {
- return Collections.emptySet().iterator();
- }
- return children.keySet().iterator();
- }
-
- @Override
- public boolean contains(Object o)
- {
- return children != null && children.containsKey(o);
- }
-
- @Override
- public int size()
- {
- if (children == null)
- {
- return 0;
- }
- return children.size();
- }
-
- @Override
- public boolean add(Object o)
- {
- throw new UnsupportedOperationException("Children names is a read-only set");
- }
-
- @Override
- public boolean remove(Object o)
- {
- throw new UnsupportedOperationException("Children names is a read-only set");
- }
-
- @Override
- public boolean addAll(Collection coll)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean removeAll(Collection coll)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean retainAll(Collection coll)
- {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void clear()
- {
- throw new UnsupportedOperationException();
- }
-
-// private Object writeReplace()
-// {
-// if (children == null)
-// {
-// return Collections.emptySet();
-// }
-// return Collections.unmodifiableSet(new HashSet(children.keySet()));
-// }
- }
}
More information about the jboss-cvs-commits
mailing list