Java 类org.mozilla.javascript.ClassCache 实例源码

项目:Push2Display    文件:RhinoInterpreter.java   
/**
 * 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);
    }
}
项目:Push2Display    文件:RhinoInterpreter.java   
/**
 * 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);
    }
}
项目:feathers-sdk    文件:RhinoInterpreter.java   
/**
 * Build a <code>Interpreter</code> for ECMAScript using Rhino.
 *
 * @param documentURL the URL for the document which references
 *
 * @see org.apache.flex.forks.batik.script.Interpreter
 * @see org.apache.flex.forks.batik.script.InterpreterPool
 */
public RhinoInterpreter(URL documentURL) {
    try {
        rhinoClassLoader = new RhinoClassLoader
            (documentURL, getClass().getClassLoader());
    } catch (SecurityException se) {
        rhinoClassLoader = null;
    }
    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.");
            }
            sb.append(TO_BE_IMPORTED[TO_BE_IMPORTED.length - 1]);
            sb.append(')');
            cx.evaluateString(globalObject, sb.toString(), null, 0,
                              rhinoClassLoader);
            return null;
        }
    };
    contextFactory.call(initAction);
}
项目:feathers-sdk    文件:RhinoInterpreter.java   
/**
 * 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);
    }
}
项目:birt    文件:JavascriptEngineFactory.java   
synchronized protected void releaseRootScope( ScriptableObject rootScope )
{
    if ( rootScope != null )
    {
        ClassCache classCache = ClassCache.get( rootScope );
        if ( classCache != null )
        {
            classCache.clearCaches( );
        }
        rootScopes.add( rootScope );
    }
}
项目:Push2Display    文件:RhinoInterpreter.java   
protected void init(URL documentURL,
                    final ImportInfo imports)
{
    try {
        rhinoClassLoader = new RhinoClassLoader
            (documentURL, getClass().getClassLoader());
    } catch (SecurityException se) {
        rhinoClassLoader = null;
    }
    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);

            ImportInfo ii = imports;
            if (ii == null) ii = ImportInfo.getImports();

            // import Java lang package & DOM Level 3 & SVG DOM packages
            StringBuffer sb = new StringBuffer();
            Iterator iter;
            iter = ii.getPackages();
            while (iter.hasNext()) {
                String pkg = (String)iter.next();
                sb.append("importPackage(Packages.");
                sb.append(pkg);
                sb.append(");");
            }
            iter = ii.getClasses();
            while (iter.hasNext()) {
                String cls = (String)iter.next();
                sb.append("importClass(Packages.");
                sb.append(cls);
                sb.append(");");
            }
            cx.evaluateString(globalObject, sb.toString(), null, 0,
                              rhinoClassLoader);
            return null;
        }
    };
    contextFactory.call(initAction);
}
项目:Push2Display    文件:RhinoInterpreter.java   
protected void init(URL documentURL,
                    final ImportInfo imports)
{
    try {
        rhinoClassLoader = new RhinoClassLoader
            (documentURL, getClass().getClassLoader());
    } catch (SecurityException se) {
        rhinoClassLoader = null;
    }
    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);

            ImportInfo ii = imports;
            if (ii == null) ii = ImportInfo.getImports();

            // import Java lang package & DOM Level 3 & SVG DOM packages
            StringBuffer sb = new StringBuffer();
            Iterator iter;
            iter = ii.getPackages();
            while (iter.hasNext()) {
                String pkg = (String)iter.next();
                sb.append("importPackage(Packages.");
                sb.append(pkg);
                sb.append(");");
            }
            iter = ii.getClasses();
            while (iter.hasNext()) {
                String cls = (String)iter.next();
                sb.append("importClass(Packages.");
                sb.append(cls);
                sb.append(");");
            }
            cx.evaluateString(globalObject, sb.toString(), null, 0,
                              rhinoClassLoader);
            return null;
        }
    };
    contextFactory.call(initAction);
}