mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 09:28:27 +00:00
add close to script services
This commit is contained in:
parent
80b8898542
commit
7180636df6
@ -70,6 +70,7 @@ import org.elasticsearch.rest.RestModule;
|
||||
import org.elasticsearch.river.RiversManager;
|
||||
import org.elasticsearch.river.RiversModule;
|
||||
import org.elasticsearch.script.ScriptModule;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.search.SearchModule;
|
||||
import org.elasticsearch.search.SearchService;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
@ -265,7 +266,6 @@ public final class InternalNode implements Node {
|
||||
injector.getInstance(RestController.class).close();
|
||||
stopWatch.stop().start("transport");
|
||||
injector.getInstance(TransportService.class).close();
|
||||
stopWatch.stop().start("http_client");
|
||||
|
||||
for (Class<? extends LifecycleComponent> plugin : pluginsService.services()) {
|
||||
stopWatch.stop().start("plugin(" + plugin.getName() + ")");
|
||||
@ -275,6 +275,9 @@ public final class InternalNode implements Node {
|
||||
stopWatch.stop().start("node_cache");
|
||||
injector.getInstance(NodeCache.class).close();
|
||||
|
||||
stopWatch.stop().start("script");
|
||||
injector.getInstance(ScriptService.class).close();
|
||||
|
||||
stopWatch.stop().start("timer");
|
||||
injector.getInstance(TimerService.class).close();
|
||||
stopWatch.stop().start("thread_pool");
|
||||
|
@ -33,4 +33,6 @@ public interface ScriptEngineService {
|
||||
ExecutableScript executable(Object compiledScript, Map<String, Object> vars);
|
||||
|
||||
Object execute(Object compiledScript, Map<String, Object> vars);
|
||||
|
||||
void close();
|
||||
}
|
||||
|
@ -64,6 +64,12 @@ public class ScriptService extends AbstractComponent {
|
||||
this.scriptEngines = builder.build();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
for (ScriptEngineService engineService : scriptEngines.values()) {
|
||||
engineService.close();
|
||||
}
|
||||
}
|
||||
|
||||
public CompiledScript compile(String script) {
|
||||
return compile(defaultLang, script);
|
||||
}
|
||||
|
@ -55,6 +55,10 @@ public class MvelScriptEngineService extends AbstractComponent implements Script
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void close() {
|
||||
// nothing to do here...
|
||||
}
|
||||
|
||||
@Override public String[] types() {
|
||||
return new String[]{"mvel"};
|
||||
}
|
||||
|
@ -46,6 +46,10 @@ public class GroovyScriptEngineService extends AbstractComponent implements Scri
|
||||
this.loader = new GroovyClassLoader(settings.getClassLoader());
|
||||
}
|
||||
|
||||
@Override public void close() {
|
||||
loader.clearCache();
|
||||
}
|
||||
|
||||
@Override public String[] types() {
|
||||
return new String[]{"groovy"};
|
||||
}
|
||||
|
@ -60,6 +60,10 @@ public class JavaScriptScriptEngineService extends AbstractComponent implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void close() {
|
||||
|
||||
}
|
||||
|
||||
@Override public String[] types() {
|
||||
return new String[]{"js", "javascript"};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user