/** * Makes an instance. */ public ScopedClassPool create(ClassPool src, ScopedClassPoolRepository repository) { return new ScopedClassPool(null, src, repository, true); } }
/** * Create a scoped classpool. * * @param cl the classloader. * @param src the original classpool. * @return the classpool */ public ScopedClassPool createScopedClassPool(ClassLoader cl, ClassPool src) { return factory.create(cl, src, this); }
private static SoftValueRef create(Object key, Object val, ReferenceQueue q) { if (val == null) return null; else return new SoftValueRef(key, val, q); }
/** * Returns <code>true</code> if this map contains a mapping for the * specified key. * * @param key * The key whose presence in this map is to be tested. */ public boolean containsKey(Object key) { processQueue(); return hash.containsKey(key); }
/** * Close the class pool */ public void close() { this.removeClassPath(classPath); classPath.close(); classes.clear(); softcache.clear(); }
/** * Get the registered classloaders. */ public Map getRegisteredCLs() { clearUnregisteredClassLoaders(); return registeredCLs; }
public ClassPool findClassPool(ClassLoader cl) { if (cl == null) return registerClassLoader(ClassLoader.getSystemClassLoader()); return registerClassLoader(cl); }
public void unregisterClassLoader(ClassLoader cl) { synchronized (registeredCLs) { ScopedClassPool pool = (ScopedClassPool)registeredCLs.remove(cl); if (pool != null) pool.close(); } }
/** * Get the class loader * * @return the class loader */ public ClassLoader getClassLoader() { ClassLoader cl = getClassLoader0(); if (cl == null && !isBootstrapCl) { throw new IllegalStateException( "ClassLoader has been garbage collected"); } return cl; }
/** * Flush a class * * @param classname * the class to flush */ public synchronized void flushClass(String classname) { classes.remove(classname); softcache.remove(classname); }
/** * Returns a set of the mappings contained in this hash table. */ public Set entrySet() { processQueue(); return hash.entrySet(); }
/** * Makes an instance. */ public ScopedClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository) { return new ScopedClassPool(cl, src, repository, false); }
private static <K,V> SoftValueRef<K,V> create( K key, V val, ReferenceQueue<V> q) { if (val == null) return null; else return new SoftValueRef<K,V>(key, val, q); }
/** * Returns the number of key-value mappings in this map. <strong>Note:</strong> * <em>In contrast with most implementations of the * <code>Map</code> interface, the time required by this operation is * linear in the size of the map.</em> */ public int size() { processQueue(); return hash.size(); }
/** * Makes an instance. */ public ScopedClassPool create(ClassPool src, ScopedClassPoolRepository repository) { return new ScopedClassPool(null, src, repository, true); } }
/** * Returns <code>true</code> if this map contains no key-value mappings. */ public boolean isEmpty() { processQueue(); return hash.isEmpty(); }
/** * Makes an instance. */ public ScopedClassPool create(ClassLoader cl, ClassPool src, ScopedClassPoolRepository repository) { return new ScopedClassPool(cl, src, repository, false); }
/** * Removes all mappings from this map. */ public void clear() { processQueue(); hash.clear(); } }
/** * Removes the mapping for the given <code>key</code> from this map, if * present. * * @param key * The key whose mapping is to be removed. * * @return The value to which this key was mapped, or <code>null</code> if * there was no mapping for the key. */ public Object remove(Object key) { processQueue(); return hash.remove(key); }