public CompiledScript loadCompiledScript(ScriptEngine engine, File file) throws FileNotFoundException, ScriptException
{
int len = L2ScriptEngineManager.SCRIPT_FOLDER.getPath().length() + 1;
String relativeName = file.getPath().substring(len);
CompiledScriptHolder csh = _compiledScriptCache.get(relativeName);
if (csh != null && csh.matches(file))
{
if (Config.DEBUG)
LOG.fine("Reusing cached compiled script: " + file);
return csh.getCompiledScript();
}
else
{
if (Config.DEBUG)
LOG.info("Compiling script: " + file);
Compilable eng = (Compilable) engine;
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
// TODO lock file
CompiledScript cs = eng.compile(reader);
if (cs instanceof Serializable)
synchronized (_compiledScriptCache)
{
_compiledScriptCache.put(relativeName, new CompiledScriptHolder(cs, file));
_modified = true;
}
return cs;
}
}
CompiledScriptCache.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:L2jBrasil
作者:
评论列表
文章目录