连接超时之后不中断线程

This commit is contained in:
orgin 2024-05-30 16:48:46 +08:00
parent 72dbf2ba80
commit 9151233f11
3 changed files with 7 additions and 7 deletions

View File

@ -621,7 +621,7 @@ public class EmailServiceManager {
try {
subject = MimeUtility.decodeText(message.getSubject());
receivedDate = message.getReceivedDate();
message.setFlag(Flags.Flag.DELETED,true);
// message.setFlag(Flags.Flag.DELETED,true);
// log.info("EmailServiceManager: Remove Email:{},receiveTime:{}",message.getSubject(), DateUtils.formatDate(message.getReceivedDate(),"yyyy-MM-dd HH:mm:ss"));
} catch (MessagingException | UnsupportedEncodingException e) {
status = EmailLogManager.STATUS_ERROR;
@ -672,7 +672,7 @@ public class EmailServiceManager {
if(numberKey >= taskProperties.getForceDeletedNumber()){
exist = true;
log.info("Check: Remove Email:{},receiveTime:{}",message.getSubject(), DateUtils.formatDate(message.getReceivedDate(),"yyyy-MM-dd HH:mm:ss"));
message.setFlag(Flags.Flag.DELETED,true);
// message.setFlag(Flags.Flag.DELETED,true);
redisUtil.del(key);
}
return exist;

View File

@ -290,7 +290,7 @@ public class AutoProcessManager{
}
//遍历邮箱执行线程如果邮箱执行线程stop属性已被设置为true则关闭资源停止线程
final Iterator<Map.Entry<String, EmailParsingActuator>> iterator = emailExecThreadMap.entrySet().iterator();
/*final Iterator<Map.Entry<String, EmailParsingActuator>> iterator = emailExecThreadMap.entrySet().iterator();
emailExecThreadMap.forEach((emailId,emailExecThread)->{
try{
if(emailExecThread.getState() != State.TERMINATED && emailExecThread.isStop()){
@ -315,7 +315,7 @@ public class AutoProcessManager{
}
}
}
});
});*/
}
long end = System.currentTimeMillis();
long sleepTime = taskProperties.getDeletedMailThreadExecCycle() - (end-start);

View File

@ -65,7 +65,7 @@ public class EmailParsingActuator extends Thread{
if (isStop) {
String nowDate = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
log.info(nowDate + " " +this.emailProperties.getName()+" EmailParsingActuator is Stop!");
closeResource();
// closeResource();
return;
}
long start = System.currentTimeMillis();
@ -110,10 +110,10 @@ public class EmailParsingActuator extends Thread{
}
} catch (MessagingException e) {
System.out.println("捕获MessagingException");
closeResource();
// closeResource();
throw new RuntimeException(e);
} catch (Exception e) {
closeResource();
// closeResource();
log.error(""+e);
} finally {
//清除本批次邮件日志缓存