MVEL engine warm up improvement
This commit is contained in:
parent
a5691f9347
commit
7ca50ac3e5
@ -24,7 +24,6 @@ import lombok.SneakyThrows;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.mvel2.ExecutionContext;
|
import org.mvel2.ExecutionContext;
|
||||||
import org.mvel2.MVEL;
|
import org.mvel2.MVEL;
|
||||||
import org.mvel2.ParserContext;
|
|
||||||
import org.mvel2.SandboxedParserConfiguration;
|
import org.mvel2.SandboxedParserConfiguration;
|
||||||
import org.mvel2.SandboxedParserContext;
|
import org.mvel2.SandboxedParserContext;
|
||||||
import org.mvel2.ScriptMemoryOverflowException;
|
import org.mvel2.ScriptMemoryOverflowException;
|
||||||
@ -44,6 +43,7 @@ import org.thingsboard.server.common.stats.TbApiUsageStateClient;
|
|||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -115,7 +115,8 @@ public class DefaultMvelInvokeService extends AbstractScriptInvokeService implem
|
|||||||
executor = MoreExecutors.listeningDecorator(ThingsBoardExecutors.newWorkStealingPool(threadPoolSize, "mvel-executor"));
|
executor = MoreExecutors.listeningDecorator(ThingsBoardExecutors.newWorkStealingPool(threadPoolSize, "mvel-executor"));
|
||||||
try {
|
try {
|
||||||
// Special command to warm up MVEL engine
|
// Special command to warm up MVEL engine
|
||||||
MVEL.compileExpression("var warmUp = {}; warmUp", new SandboxedParserContext(parserConfig));
|
Serializable script = MVEL.compileExpression("var warmUp = {}; warmUp", new SandboxedParserContext(parserConfig));
|
||||||
|
MVEL.executeTbExpression(script, new ExecutionContext(), Collections.emptyMap());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user