/** * 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 = ((EvictableCache<String, Class>)classCache).clearAll(); 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()); } }
/** * 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()); } } }
@Override public void stop() throws Exception { InvokerHelper.removeClass(script); }
/** * {@inheritDoc} * * @see org.xwiki.cache.DisposableCacheValue#dispose() */ public void dispose() throws Exception { if (this.cl != null) { InvokerHelper.removeClass(this.cl); } } }
private void removeOldScript() { if (compiledScript != null) { InvokerHelper.removeClass(compiledScript.getClass()); compiledScript = null; } }
/** * {@inheritDoc} * * @see org.xwiki.cache.DisposableCacheValue#dispose() */ public void dispose() throws Exception { if (this.script != null) { InvokerHelper.removeClass(this.script.getClass()); } }
/** * 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(InputStream in, String fileName) throws CompilationFailedException { Script script = null; try { script = parse(in, fileName); return script.run(); } finally { if (script != null) { InvokerHelper.removeClass(script.getClass()); } } }
/** * 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(InputStream in, String fileName) throws CompilationFailedException { Script script = null; try { script = parse(in, fileName); return script.run(); } finally { if (script != null) { InvokerHelper.removeClass(script.getClass()); } } }
/** * 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(InputStream in, String fileName) throws CompilationFailedException { Script script = null; try { script = parse(in, fileName); return script.run(); } finally { if (script != null) { InvokerHelper.removeClass(script.getClass()); } } }
/** * 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); script.setBinding(context); return script.run(); } finally { if (script != null) { InvokerHelper.removeClass(script.getClass()); } } }
/** * 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) * * @deprecated Prefer using methods taking a Reader rather than an InputStream to avoid wrong encoding issues. */ public Object evaluate(InputStream in, String fileName) throws CompilationFailedException { Script script = null; try { script = parse(in, fileName); script.setBinding(context); return script.run(); } finally { if (script != null) { InvokerHelper.removeClass(script.getClass()); } } }