提交 f9e55265 authored 作者: yangli's avatar yangli

.

上级 50809b29
package com.priusis.cache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
......@@ -16,6 +18,7 @@ import java.util.Map;
* @since 2021/09/22
*/
@Component
@Slf4j
public class InstalledProgramCache {
private static List<Map<String, String>> programList;
......@@ -25,6 +28,15 @@ public class InstalledProgramCache {
return programList;
}
@PostConstruct
public void init() {
try {
loadProgramListJob();
} catch (IOException e) {
log.error("初始化失败", e);
}
}
@Scheduled(fixedDelay = 3000)
public void loadProgramListJob() throws IOException {
......
......@@ -63,9 +63,6 @@ public class ProgramController {
private String addProgramUrl;
@Resource
private InstalledProgramCache installedProgramCache;
......@@ -153,7 +150,7 @@ public class ProgramController {
MAP.put(key, new Thread(() -> {
int exitVal = -1;
try {
exitVal = Runtime.getRuntime().exec("cmd /c \"" + file.getPath() +"\"").waitFor();
exitVal = Runtime.getRuntime().exec("cmd /c \"" + file.getPath() + "\"").waitFor();
} catch (Exception e) {
log.error("执行安装文件 {} 失败", file.getPath(), e);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论