修复 创建临时目录后没有删除的问题

This commit is contained in:
chenjinsong
2018-11-23 18:23:25 +08:00
parent dcb7995f88
commit 238b257634

View File

@@ -138,11 +138,9 @@ public class ChangePluginScriptFile implements Runnable {
} }
} }
} }
for (String ip : ncNodesIpStrSet) { for (String ip : ncNodesIpStrSet) {
Common.runChangeRunnable(new SendPluginScriptFile(ip, sendRecordList.get(ip))); Common.runChangeRunnable(new SendPluginScriptFile(ip, sendRecordList.get(ip)));
} }
// 延时清理脚本 // 延时清理脚本
new Thread(new DeletePluginScriptDirAfterSending()).start(); new Thread(new DeletePluginScriptDirAfterSending()).start();
@@ -408,7 +406,7 @@ public class ChangePluginScriptFile implements Runnable {
String ips = Common.getIpSeqIdMap().get(recvIpSet.iterator().next())+""; String ips = Common.getIpSeqIdMap().get(recvIpSet.iterator().next())+"";
changeService.saveEventRecordLibrary(SEND_PLUGIN_SCRIPT_FILE, ips, changeService.saveEventRecordLibrary(SEND_PLUGIN_SCRIPT_FILE, ips,
"S2C", JSONObject.fromObject(recordContent).toString()); "S2C", JSONObject.fromObject(recordContent).toString());
task.new DeletePluginScriptDirAfterSending().run();
} catch (SQLException e) { } catch (SQLException e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} finally { } finally {
@@ -519,6 +517,7 @@ public class ChangePluginScriptFile implements Runnable {
e.printStackTrace(); e.printStackTrace();
} }
} }
logger.debug("删除临时目录" + pluginScriptDir.getAbsolutePath());
FileUtils.deleteAllFiles(pluginScriptDir, true); FileUtils.deleteAllFiles(pluginScriptDir, true);
} }
} }
@@ -533,6 +532,7 @@ public class ChangePluginScriptFile implements Runnable {
File tempPluginDir = new File(Constants.PLUGIN_SCRIPT_FILE_DIR, System.currentTimeMillis()+""); File tempPluginDir = new File(Constants.PLUGIN_SCRIPT_FILE_DIR, System.currentTimeMillis()+"");
if (!tempPluginDir.exists()) { if (!tempPluginDir.exists()) {
tempPluginDir.mkdirs(); tempPluginDir.mkdirs();
logger.debug("创建临时目录" + tempPluginDir.getAbsolutePath());
} }
return tempPluginDir; return tempPluginDir;
} }