Examples of ClassCache


Examples of org.jruby.util.ClassCache

        System.setProperty("jruby.compile.mode", "JIT");
        System.setProperty("jruby.jit.threshold", "0");

        // construct a new cache with thread's classloader and no limit
        ClassCache classCache = JavaEmbedUtils.createClassCache(Thread.currentThread().getContextClassLoader());
        runtime1 = JavaEmbedUtils.initialize(new ArrayList<Object>(), classCache);
        runtime2 = JavaEmbedUtils.initialize(new ArrayList<Object>(), classCache);
        evaler = JavaEmbedUtils.newRuntimeAdapter();
       
        super.setUp();
View Full Code Here

Examples of org.jruby.util.ClassCache

        assertEquals(NullLoadService.class, ruby.getLoadService().getClass());
    }

    public void testSettingNewLoaderWillCreateNewClassLoader() throws Exception {
        ClassLoader beforeCL = config.getLoader();
        ClassCache beforeCC = config.getClassCache();
        config.setLoader(beforeCL);
        assertTrue("setting a new classloader that is the same, should not create a new classcache", beforeCC == config.getClassCache());

        config.setLoader(new URLClassLoader(new java.net.URL[0], beforeCL));
        assertTrue("setting a new classloader this is different, should create a new classcache", beforeCC != config.getClassCache());
View Full Code Here

Examples of org.jruby.util.ClassCache

     *
     * @param loader use the provided classloader to create the cache
     * @return
     */
    public static ClassCache createClassCache(ClassLoader loader) {
        return new ClassCache(loader, new RubyInstanceConfig().getJitMax());
    }
View Full Code Here

Examples of org.jruby.util.ClassCache

     *
     * @param loader use the provided classloader to create the cache
     * @return
     */
    public static ClassCache createClassCache(ClassLoader loader) {
        return new ClassCache(loader, new RubyInstanceConfig().getJitMax());
    }
View Full Code Here

Examples of org.jruby.util.ClassCache

       
        Runnable jitTask = new Runnable() {
            public void run() {
                try {
                    // The cache is full. Abandon JIT for this method and bail out.
                    ClassCache classCache = config.getClassCache();
                    if (classCache.isFull()) {
                        counts.abandonCount.incrementAndGet();
                        return;
                    }

                    // Check if the method has been explicitly excluded
View Full Code Here

Examples of org.mozilla.javascript.ClassCache

        ContextAction initAction = new ContextAction() {
            public Object run(Context cx) {
                Scriptable scriptable = cx.initStandardObjects(null, false);
                defineGlobalWrapperClass(scriptable);
                globalObject = createGlobalObject(cx);
                ClassCache cache = ClassCache.get(globalObject);
                cache.setCachingEnabled(rhinoClassLoader != null);
                // import Java lang package & DOM Level 3 & SVG DOM packages
                StringBuffer sb = new StringBuffer("importPackage(Packages.");
                for (int i = 0; i < TO_BE_IMPORTED.length - 1; i++) {
                    sb.append(TO_BE_IMPORTED[i]);
                    sb.append(");importPackage(Packages.");
View Full Code Here

Examples of org.mozilla.javascript.ClassCache

     * For <code>RhinoInterpreter</code> this method flushes the
     * Rhino caches to avoid memory leaks.
     */
    public void dispose() {
        if (rhinoClassLoader != null) {
            ClassCache cache = ClassCache.get(globalObject);
            cache.setCachingEnabled(false);
        }
    }
View Full Code Here

Examples of org.mozilla.javascript.ClassCache

        ContextAction initAction = new ContextAction() {
            public Object run(Context cx) {
                Scriptable scriptable = cx.initStandardObjects(null, false);
                defineGlobalWrapperClass(scriptable);
                globalObject = createGlobalObject(cx);
                ClassCache cache = ClassCache.get(globalObject);
                cache.setCachingEnabled(rhinoClassLoader != null);
                // import Java lang package & DOM Level 3 & SVG DOM packages
                StringBuffer sb = new StringBuffer("importPackage(Packages.");
                for (int i = 0; i < TO_BE_IMPORTED.length - 1; i++) {
                    sb.append(TO_BE_IMPORTED[i]);
                    sb.append(");importPackage(Packages.");
View Full Code Here

Examples of org.mozilla.javascript.ClassCache

     * For <code>RhinoInterpreter</code> this method flushes the
     * Rhino caches to avoid memory leaks.
     */
    public void dispose() {
        if (rhinoClassLoader != null) {
            ClassCache cache = ClassCache.get(globalObject);
            cache.setCachingEnabled(false);
        }
    }
View Full Code Here

Examples of org.mozilla.javascript.ClassCache

        ContextAction initAction = new ContextAction() {
            public Object run(Context cx) {
                Scriptable scriptable = cx.initStandardObjects(null, false);
                defineGlobalWrapperClass(scriptable);
                globalObject = createGlobalObject(cx);
                ClassCache cache = ClassCache.get(globalObject);
                cache.setCachingEnabled(rhinoClassLoader != null);
                // import Java lang package & DOM Level 3 & SVG DOM packages
                StringBuffer sb = new StringBuffer("importPackage(Packages.");
                for (int i = 0; i < TO_BE_IMPORTED.length - 1; i++) {
                    sb.append(TO_BE_IMPORTED[i]);
                    sb.append(");importPackage(Packages.");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.