brightonStores = BrightonUtil.getStoreInfo(file.getName(), dir.getAbsolutePath(),mailInfoST);
String status = "604";
if (!brightonStores.isEmpty()) {
status = brightonStoreService.saveDeleteBrightonStore(brightonStores,mailInfoST);
storeLog.info("Adding Store records Status:: "+status);
if (status.equals("600")) {
storeLog.info("File: " + file.getName() + " No of records: " + brightonStores.size() + " :: Added");
mailInfoST.setToSend(false);
//mailTimerTaskST.cancel();
} else {
storeLog.info("File: " + file.getName() + " :: Error in adding records");
writer.append("File: " + file.getName() + " :: Error in adding records"+"\n" + mailInfoST.getResult());
writer.close();
BrightonUtil.setMailInfo(mailInfoST, true, false, "File: " + file.getName() + " :: Error in adding records");
mailTimerST.schedule(mailTimerTaskST, new java.util.Date(), 1000*configurationManager.getFileUploadErrorMailTimer());
}
} else {
storeLog.info("File: " + file.getName() + " :: Error in adding records");
storeLog.info("File: " + file.getName() + " :: No record found ");
writer.append("File: " + file.getName() + " :: Error in adding records");
writer.append("\nFile: " + file.getName() + " :: No record found ");
if(null != mailInfoST.getResult()){
storeLog.info(mailInfoST.getResult());
writer.append("\n"+mailInfoST.getResult());
}
writer.close();
BrightonUtil.setMailInfo(mailInfoST, true, false, "File: " + file.getName() + " :: Error in adding records");
mailTimerST.schedule(mailTimerTaskST, new java.util.Date(), 1000*configurationManager.getFileUploadErrorMailTimer());
}
} else if(validationStatus.equals("604")){
storeLog.error("Error in Brighton Store data file :: Invalid structure or value :: "+ file.getName());
writer.append("Error in Brighton Store data file :: Invalid structure or value :: "+ file.getName() + "\n" + mailInfoST.getResult());
writer.close();
BrightonUtil.setMailInfo(mailInfoST, true, false, "Error in Brighton Store data file :: Invalid structure or value :: "+ file.getName());
mailTimerST.schedule(mailTimerTaskST, new java.util.Date(), 1000*configurationManager.getFileUploadErrorMailTimer());
} else {
storeLog.error("Error in reading data from Brighton Store file :: " + file.getName());
writer.append("Error in reading data from Brighton Store file :: " + file.getName()+ "\n" + mailInfoST.getResult());
writer.close();
BrightonUtil.setMailInfo(mailInfoST, true, false, "Error in reading data from Brighton Store file :: " + file.getName());
mailTimerST.schedule(mailTimerTaskST, new java.util.Date(), 1000*configurationManager.getFileUploadErrorMailTimer());
}
brightonStores = null;
java.lang.Runtime.getRuntime().gc();
是否可以在Timer中重新构造TimerTask ..
答案 0 :(得分:0)
您无法在计时器内重新安排TimerTask。如果要更改运行任务的计划,则需要取消旧计时器并创建一个新计时器。