feat: 虚拟设备 - VirtualManager 定时任务开启;VirtualDeviceController 修改虚拟设备优化
parent
8c44979dcf
commit
9a4109fedb
|
@ -82,6 +82,9 @@ public class VirtualDeviceController {
|
|||
VirtualDevice oldData = checkOwner(virtualDevice.getId());
|
||||
ReflectUtil.copyNoNulls(virtualDevice, oldData,
|
||||
"name", "productKey", "type", "trigger", "triggerExpression");
|
||||
if (VirtualDevice.STATE_RUNNING.equals(virtualDevice.getState())) {
|
||||
virtualManager.remove(oldData);
|
||||
}
|
||||
virtualDevice.setState(VirtualDevice.STATE_STOPPED);
|
||||
virtualDeviceData.save(virtualDevice);
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@ public class VirtualManager {
|
|||
private MqProducer<ThingModelMessage> producer;
|
||||
|
||||
public VirtualManager(){
|
||||
// ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
|
||||
// executorService.schedule(this::init, 8, TimeUnit.SECONDS);
|
||||
ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
|
||||
executorService.schedule(this::init, 8, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
|
|
Loading…
Reference in New Issue