
org.jruby.util.ClassCache Maven / Gradle / Ivy
package org.jruby.util;
import org.jruby.util.log.Logger;
import org.jruby.util.log.LoggerFactory;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.security.ProtectionDomain;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import org.jruby.RubyInstanceConfig;
import org.jruby.util.cli.Options;
/**
* A Simple cache which maintains a collection of classes that can potentially be shared among
* multiple runtimes (or whole JVM).
*/
public class ClassCache {
private static final Logger LOG = LoggerFactory.getLogger("ClassCache");
private final AtomicInteger classLoadCount = new AtomicInteger(0);
private final AtomicInteger classReuseCount = new AtomicInteger(0);
private final ReferenceQueue referenceQueue = new ReferenceQueue();
private final Map