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