fix:自动处理增加日志写入

This commit is contained in:
xiaoguangbin 2024-11-13 15:56:38 +08:00
parent 8a6e79aef9
commit d71544534c
2 changed files with 10 additions and 1 deletions

View File

@ -120,6 +120,7 @@ public class AutoProcessManager{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}
@ -169,6 +170,7 @@ public class AutoProcessManager{
//捕获异常不处理保障线程异常不退出
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage(), e);
}
long end = System.currentTimeMillis();
long sleepTime = taskProperties.getMonitoringMailCommStatusCycle() - (end-start);
@ -178,6 +180,7 @@ public class AutoProcessManager{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}
@ -251,6 +254,7 @@ public class AutoProcessManager{
//捕获异常不处理保障线程异常不退出
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage(), e);
}
long end = System.currentTimeMillis();
long sleepTime = taskProperties.getMonitoringMailDataCycle() - (end-start);
@ -260,6 +264,7 @@ public class AutoProcessManager{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}
@ -304,6 +309,7 @@ public class AutoProcessManager{
}
}catch (Exception e){
e.printStackTrace();
log.error(e.getMessage(), e);
}finally {
if(emailExecThread.getState() != State.TERMINATED && emailExecThread.isStop()){
final long nowTime = System.currentTimeMillis();
@ -325,6 +331,7 @@ public class AutoProcessManager{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
}
}
}

View File

@ -86,8 +86,8 @@ public class EmailParsingActuator extends Thread{
List<String> messageIds = new ArrayList<>();
try {
Message[] messages = emailServiceManager.receiveMail();
log.info("EmailParsingActuator本次{}获取邮件数量为:{}", Thread.currentThread().getName(), ArrayUtils.isEmpty(messages) ? 0 : messages.length);
if(ArrayUtils.isNotEmpty(messages)){
log.info("EmailParsingActuator本次{}获取邮件数量为:{}", Thread.currentThread().getName(), messages.length);
//检验获取的邮件是否在之前删除失败列表中若在直接调用邮件API删除并且此次数组里元素也删除
for(int i=messages.length-1;i>=0;i--){
if (null == messages[i].getHeader("Message-ID")) {
@ -142,6 +142,8 @@ public class EmailParsingActuator extends Thread{
TimeUnit.MILLISECONDS.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
log.error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
}