fix: 单独执行时,scriptEngine为null的bug
parent
b412eec2a8
commit
53b13b0b3a
|
@ -130,6 +130,12 @@ public class VirtualManager {
|
|||
.build();
|
||||
try {
|
||||
IScriptEngine scriptEngine = virtualScripts.get(virtualDevice.getId());
|
||||
if ( null == scriptEngine ) {
|
||||
//添加新的脚本对象
|
||||
scriptEngine = ScriptEngineFactory.getScriptEngine("js");
|
||||
scriptEngine.setScript(virtualDevice.getScript());
|
||||
virtualScripts.put(virtualDevice.getId(), scriptEngine);
|
||||
}
|
||||
for (String deviceId : devices) {
|
||||
DeviceInfo device = deviceInfoData.findByDeviceId(deviceId);
|
||||
processReport(scriptEngine.invokeMethod(new TypeReference<>() {
|
||||
|
|
Loading…
Reference in New Issue