当前位置: 首页>>代码示例>>Java>>正文


Java InvokerHelper.removeClass方法代码示例

本文整理汇总了Java中org.codehaus.groovy.runtime.InvokerHelper.removeClass方法的典型用法代码示例。如果您正苦于以下问题:Java InvokerHelper.removeClass方法的具体用法?Java InvokerHelper.removeClass怎么用?Java InvokerHelper.removeClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.codehaus.groovy.runtime.InvokerHelper的用法示例。


在下文中一共展示了InvokerHelper.removeClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clearCache

import org.codehaus.groovy.runtime.InvokerHelper; //导入方法依赖的package包/类
/**
 * Removes all classes from the class cache.
 * <p>
 * In addition to internal caches this method also clears any
 * previously set MetaClass information for the given set of
 * classes being removed.
 *
 * @see #getClassCacheEntry(String)
 * @see #setClassCacheEntry(Class)
 * @see #removeClassCacheEntry(String)
 */
public void clearCache() {
    Map<String, Class> clearedClasses = classCache.clear();

    sourceCache.clear();

    for (Map.Entry<String, Class> entry : clearedClasses.entrySet()) {
        // Another Thread may be using an instance of this class
        // (for the first time) requiring a ClassInfo lock and
        // classloading which would require a lock on classCache.
        // The following locks on ClassInfo and to avoid deadlock
        // should not be done with a classCache lock.
        InvokerHelper.removeClass(entry.getValue());
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:26,代码来源:GroovyClassLoader.java

示例2: evaluate

import org.codehaus.groovy.runtime.InvokerHelper; //导入方法依赖的package包/类
/**
 * Evaluates some script against the current Binding and returns the result
 *
 * @param in       the stream reading the script
 * @param fileName is the logical file name of the script (which is used to create the class name of the script)
 */
public Object evaluate(Reader in, String fileName) throws CompilationFailedException {
    Script script = null;
    try {
        script = parse(in, fileName);
        return script.run();
    } finally {
        if (script != null) {
            InvokerHelper.removeClass(script.getClass());
        }
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:18,代码来源:GroovyShell.java

示例3: evaluate

import org.codehaus.groovy.runtime.InvokerHelper; //导入方法依赖的package包/类
private Object evaluate(InputStream in, String fileName, Writer out, MgnlGroovyConsole console) throws CompilationFailedException {

        Script script = null;
        try {
            script = createScript(in, out, console);
            script.setProperty("ctx", MgnlContext.getInstance());
            return script.run();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (script != null) {
                InvokerHelper.removeClass(script.getClass());
            }
        }
    }
 
开发者ID:rah003,项目名称:scripted-select,代码行数:16,代码来源:ScriptableSelectFieldFactory.java


注:本文中的org.codehaus.groovy.runtime.InvokerHelper.removeClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。