public boolean isEmpty() { processQueue(); return map.isEmpty(); }
public boolean removeAll(Collection c) { processQueue(); Iterator iter = c.iterator(); boolean removed = false; while( iter.hasNext() ) { Object value = iter.next(); removed |= remove(value); } return removed; }
public Object[] toArray() { processQueue(); return toArray(new Object[0]); }
/** * Create a new LoaderRepositoryClassLoader * * @param urls the urls * @param parent the parent classloader */ @SuppressWarnings("unchecked") protected RepositoryClassLoader(URL[] urls, ClassLoader parent) { super(urls, parent); this.parent = parent; // Check the blacklist mode String mode = ClassToStringAction.getProperty("org.jboss.mx.loading.blacklistMode", null); if( mode == null || mode.equalsIgnoreCase("HashSet") ) { classBlackList = Collections.synchronizedSet(new HashSet<String>()); resourceBlackList = Collections.synchronizedSet(new HashSet<String>()); } else if( mode.equalsIgnoreCase("SoftSet") ) { classBlackList = Collections.synchronizedSet(new SoftSet()); resourceBlackList = Collections.synchronizedSet(new SoftSet()); } }
public boolean retainAll(Collection c) { Iterator iter = iterator(); boolean removed = false; while( iter.hasNext() ) { Object value = iter.next(); if( c.contains(value) == false ) { iter.remove(); removed = true; } } return removed; }
/** * Create a new LoaderRepositoryClassLoader * * @param urls the urls * @param parent the parent classloader */ protected RepositoryClassLoader(URL[] urls, ClassLoader parent) { super(urls, parent); this.parent = parent; // Check the blacklist mode String mode = ClassToStringAction.getProperty("org.jboss.mx.loading.blacklistMode", null); if( mode == null || mode.equalsIgnoreCase("HashSet") ) { classBlackList = Collections.synchronizedSet(new HashSet()); resourceBlackList = Collections.synchronizedSet(new HashSet()); } else if( mode.equalsIgnoreCase("SoftSet") ) { classBlackList = Collections.synchronizedSet(new SoftSet()); resourceBlackList = Collections.synchronizedSet(new SoftSet()); } }
public int size() { processQueue(); return map.size(); }
public boolean contains(Object o) { processQueue(); Integer key = new Integer(o.hashCode()); boolean contains = map.containsKey(key); return contains; }
public boolean remove(Object o) { processQueue(); Integer key = new Integer(o.hashCode()); return map.remove(key) != null; }
public boolean containsAll(Collection c) { processQueue(); Iterator iter = c.iterator(); boolean contains = true; while( iter.hasNext() ) { Object value = iter.next(); Integer key = new Integer(value.hashCode()); contains &= map.containsKey(key); } return contains; }
public Iterator iterator() { processQueue(); Iterator theIter = map.values().iterator(); return new ComparableSoftReferenceIterator(theIter); }
public boolean add(Object o) { processQueue(); Integer key = new Integer(o.hashCode()); ComparableSoftReference sr = new ComparableSoftReference(key, o, gcqueue); return map.put(key, sr) == null; }
public boolean addAll(Collection c) { processQueue(); Iterator iter = c.iterator(); boolean added = false; while( iter.hasNext() ) { Object value = iter.next(); Integer key = new Integer(value.hashCode()); ComparableSoftReference sr = new ComparableSoftReference(key, value, gcqueue); added |= map.put(key, sr) == null; } return added; }
public Object[] toArray(Object[] a) { processQueue(); int size = map.size(); Object[] array = {}; if( a.length >= size ) array = a; Iterator iter = map.values().iterator(); int index = 0; while( iter.hasNext() ) { ComparableSoftReference csr = (ComparableSoftReference) iter.next(); Object value = csr.get(); // Create the correct array type if( array.length == 0 ) { if( value == null ) { index ++; continue; } Array.newInstance(value.getClass(), size); } array[index] = value; index ++; } return array; }