/** * Create a new ClassLoader with no parent. * * @param policy the policy * @throws IllegalArgumentException for a null policy * @throws IllegalStateException if the policy is already associated with a classloader */ public BaseClassLoader(ClassLoaderPolicy policy) { super(null); if (policy == null) throw new IllegalArgumentException("Null policy"); this.policy = policy; BaseClassLoaderPolicy basePolicy = policy; basePolicy.setClassLoader(this); loader = new DelegateLoader(policy); if (basePolicy.isCacheable()) resourceCache = new ConcurrentHashMap<String, URL>(); if (basePolicy.isBlackListable()) blackList = new ConcurrentHashMap<String, String>(); log.debug("Created " + this + " with policy " + policy.toLongString()); }
/** * Create a new ClassLoader with no parent. * * @param policy the policy * @throws IllegalArgumentException for a null policy * @throws IllegalStateException if the policy is already associated with a classloader */ public BaseClassLoader(ClassLoaderPolicy policy) { super(null); if (policy == null) throw new IllegalArgumentException("Null policy"); this.policy = policy; BaseClassLoaderPolicy basePolicy = policy; basePolicy.setClassLoader(this); loader = new DelegateLoader(policy); if (basePolicy.isCacheable()) resourceCache = new ConcurrentHashMap<String, URL>(); if (basePolicy.isBlackListable()) blackList = new ConcurrentSet<String>(); log.debugf("Created %1s with policy %2s", this, policy); }