提交 1f3ef355 authored 作者: yangli's avatar yangli

.

上级 0fe5ab0a
......@@ -76,7 +76,9 @@ public class RemoteControlController {
return startVncServer(minutes);
}
private R<Void> startVncServer(long minutes)
private Timer timer = new Timer();
private synchronized R<Void> startVncServer(long minutes)
throws IOException, ConfigParser.DuplicateSectionException, ConfigParser.NoSectionException {
// 查询设备的远程ID
String remoteId = getRemoteId();
......@@ -96,12 +98,12 @@ public class RemoteControlController {
StrUtil.format("-autoreconnect ID:{} -connect {} -run", remoteId, vncRepeater));
configParser.write(file);
// 重启VNC Server服务
Runtime.getRuntime().exec("cmd /c net stop uvnc_service");
// 启动VNC Server服务
timer.cancel();
Runtime.getRuntime().exec("cmd /c net start uvnc_service");
// 定时任务,指定分钟后执行一次
Timer timer = new Timer();
timer = new Timer();
timer.schedule(new TimerTask() {
@SneakyThrows
@Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论