Add special command to warm up MVEL engine

This commit is contained in:
Igor Kulikov 2022-11-03 11:18:30 +02:00
parent 323a47a744
commit b65aa4cc8a

View File

@ -113,6 +113,12 @@ public class DefaultMvelInvokeService extends AbstractScriptInvokeService implem
parserConfig.addImport("JSON", TbJson.class); parserConfig.addImport("JSON", TbJson.class);
TbUtils.register(parserConfig); TbUtils.register(parserConfig);
executor = MoreExecutors.listeningDecorator(ThingsBoardExecutors.newWorkStealingPool(threadPoolSize, "mvel-executor")); executor = MoreExecutors.listeningDecorator(ThingsBoardExecutors.newWorkStealingPool(threadPoolSize, "mvel-executor"));
try {
// Special command to warm up MVEL engine
MVEL.compileExpression("var warmUp = {}; warmUp", new SandboxedParserContext(parserConfig));
} catch (Exception e) {
// do nothing
}
} }
@PreDestroy @PreDestroy