自动处理模块自动处理程序管理类增加邮箱更新数据相关逻辑代码
邮件属性实体类增加标识resetFlag,标识邮件基础信息是否需要进行更新 邮件解析执行代码增加更新邮箱基础信息方法 邮件解析执行代码增加逻辑判断当前线程是否处于中止状态,如果处于中止状态结束当前方法 自动处理模块错误日志写入代码中动态错误增加日志文件名称的拼写生成
This commit is contained in:
parent
a27ddf6c2c
commit
6cf57cf41a
|
@ -42,7 +42,7 @@ public class AutoProcessManager{
|
||||||
/**
|
/**
|
||||||
* 以邮件id为key,以邮件执行线程为value
|
* 以邮件id为key,以邮件执行线程为value
|
||||||
*/
|
*/
|
||||||
private Map<String,Thread> emailExecThreadMap = new HashMap<>();
|
private Map<String,EmailParsingActuator> emailExecThreadMap = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动自动处理
|
* 启动自动处理
|
||||||
|
@ -79,12 +79,17 @@ public class AutoProcessManager{
|
||||||
EmailProperties next = iterator.next();
|
EmailProperties next = iterator.next();
|
||||||
if(next.isDelFlag()){
|
if(next.isDelFlag()){
|
||||||
if(emailExecThreadMap.containsKey(next.getId())){
|
if(emailExecThreadMap.containsKey(next.getId())){
|
||||||
Thread thread = emailExecThreadMap.get(next.getId());
|
EmailParsingActuator actuator = emailExecThreadMap.get(next.getId());
|
||||||
thread.interrupt();
|
actuator.interrupt();
|
||||||
emailExecThreadMap.remove(next.getId());
|
emailExecThreadMap.remove(next.getId());
|
||||||
}
|
}
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
|
if (next.isResetFlag()) {
|
||||||
|
EmailParsingActuator actuator = emailExecThreadMap.get(next.getId());
|
||||||
|
actuator.updateEmail(next);
|
||||||
|
next.setResetFlag(false);
|
||||||
|
}
|
||||||
if(next.isNewEmailFlag()){
|
if(next.isNewEmailFlag()){
|
||||||
EmailParsingActuator emailParsingActuator = new EmailParsingActuator();
|
EmailParsingActuator emailParsingActuator = new EmailParsingActuator();
|
||||||
emailParsingActuator.init(next,spectrumServiceQuotes,emailCounter,systemStartupTime);
|
emailParsingActuator.init(next,spectrumServiceQuotes,emailCounter,systemStartupTime);
|
||||||
|
@ -185,9 +190,15 @@ public class AutoProcessManager{
|
||||||
}
|
}
|
||||||
//如果包含邮箱id 并且 邮箱处于启用状态 将邮箱数据进行更新
|
//如果包含邮箱id 并且 邮箱处于启用状态 将邮箱数据进行更新
|
||||||
if (flag && email.getEnabled().equals(SysMailEnableType.ENABLE.getMailEnableType())) {
|
if (flag && email.getEnabled().equals(SysMailEnableType.ENABLE.getMailEnableType())) {
|
||||||
|
EmailProperties properties = emailMap.get(email.getId());
|
||||||
|
//判断邮箱的用户名,密码是否与原邮箱用户名,密码一致
|
||||||
|
//如果不一致则进行更新
|
||||||
|
if ( !properties.getUsername().equals(email.getUsername()) || !properties.getPassword().equals(email.getPassword()) ) {
|
||||||
|
email.setResetFlag(true);
|
||||||
putSysEmailMap(email);
|
putSysEmailMap(email);
|
||||||
log.info("{}邮箱加入监测队列",email.getEmailServerAddress());
|
log.info("{}邮箱加入监测队列",email.getEmailServerAddress());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//如果不包含邮箱id 并且 邮箱处于启用状态 将邮箱对象存入到map中 并将新邮箱标识设置为true
|
//如果不包含邮箱id 并且 邮箱处于启用状态 将邮箱对象存入到map中 并将新邮箱标识设置为true
|
||||||
if(!flag && email.getEnabled().equals(SysMailEnableType.ENABLE.getMailEnableType())){
|
if(!flag && email.getEnabled().equals(SysMailEnableType.ENABLE.getMailEnableType())){
|
||||||
email.setNewEmailFlag(true);
|
email.setNewEmailFlag(true);
|
||||||
|
|
|
@ -44,8 +44,15 @@ public class EmailParsingActuator extends Thread{
|
||||||
poolExecutor = new ThreadPoolExecutor(taskProperties.getReceiveNum(),maximumPoolSize,5, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),threadFactory);
|
poolExecutor = new ThreadPoolExecutor(taskProperties.getReceiveNum(),maximumPoolSize,5, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),threadFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateEmail(EmailProperties emailProperties) {
|
||||||
|
this.emailProperties = emailProperties;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (this.isInterrupted()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for(;;){
|
for(;;){
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
final EmailServiceManager emailServiceManager = EmailServiceManager.getInstance();
|
final EmailServiceManager emailServiceManager = EmailServiceManager.getInstance();
|
||||||
|
@ -87,4 +94,6 @@ public class EmailParsingActuator extends Thread{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class ErrorLogManager {
|
||||||
}
|
}
|
||||||
}else if(event.getEventType() == ErrorEventType.DYNAMIC_EVENT.getEventType()){
|
}else if(event.getEventType() == ErrorEventType.DYNAMIC_EVENT.getEventType()){
|
||||||
errorContent = event.getDynamicErrorContent();
|
errorContent = event.getDynamicErrorContent();
|
||||||
|
fileName = event.getFileName().substring(0,event.getFileName().lastIndexOf(StringConstant.DOT))+SUFFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,4 +23,9 @@ public class EmailProperties extends SysEmail {
|
||||||
*/
|
*/
|
||||||
private boolean delFlag;
|
private boolean delFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱是否需要进行更新
|
||||||
|
*/
|
||||||
|
private boolean resetFlag;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user