自动处理报告增加停止标识,如果邮箱启用修改为未启用状态,停止标识设置为true,停止线程代码的执行
This commit is contained in:
parent
6cf57cf41a
commit
bcc049191c
|
@ -115,7 +115,12 @@ public class EmailServiceManager {
|
||||||
properties.put("mail.store.protocol", "imap");
|
properties.put("mail.store.protocol", "imap");
|
||||||
properties.put("mail.imap.host", email.getEmailServerAddress());
|
properties.put("mail.imap.host", email.getEmailServerAddress());
|
||||||
properties.put("mail.imap.port",email.getPort());
|
properties.put("mail.imap.port",email.getPort());
|
||||||
properties.put("mail.imap.ssl.enable", "true");
|
if (email.getIsQiye() == 1) {
|
||||||
|
properties.put("mail.imap.ssl.enable", "true");
|
||||||
|
} else {
|
||||||
|
properties.put("mail.imap.ssl.enable", "false");
|
||||||
|
}
|
||||||
|
|
||||||
//获取邮件回话
|
//获取邮件回话
|
||||||
final Session session = Session.getDefaultInstance(properties);
|
final Session session = Session.getDefaultInstance(properties);
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class AutoProcessManager{
|
||||||
if(next.isDelFlag()){
|
if(next.isDelFlag()){
|
||||||
if(emailExecThreadMap.containsKey(next.getId())){
|
if(emailExecThreadMap.containsKey(next.getId())){
|
||||||
EmailParsingActuator actuator = emailExecThreadMap.get(next.getId());
|
EmailParsingActuator actuator = emailExecThreadMap.get(next.getId());
|
||||||
actuator.interrupt();
|
actuator.setStop(true);
|
||||||
emailExecThreadMap.remove(next.getId());
|
emailExecThreadMap.remove(next.getId());
|
||||||
}
|
}
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules;
|
package org.jeecg.modules;
|
||||||
|
|
||||||
|
import lombok.Setter;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.jeecg.common.email.EmailLogManager;
|
import org.jeecg.common.email.EmailLogManager;
|
||||||
import org.jeecg.common.email.EmailServiceManager;
|
import org.jeecg.common.email.EmailServiceManager;
|
||||||
|
@ -26,6 +27,8 @@ public class EmailParsingActuator extends Thread{
|
||||||
private SpectrumServiceQuotes spectrumServiceQuotes;
|
private SpectrumServiceQuotes spectrumServiceQuotes;
|
||||||
private EmailCounter emailCounter;
|
private EmailCounter emailCounter;
|
||||||
private Date systemStartupTime;
|
private Date systemStartupTime;
|
||||||
|
@Setter
|
||||||
|
private boolean isStop;
|
||||||
|
|
||||||
public void init(EmailProperties emailProperties,SpectrumServiceQuotes spectrumServiceQuotes,
|
public void init(EmailProperties emailProperties,SpectrumServiceQuotes spectrumServiceQuotes,
|
||||||
EmailCounter emailCounter,Date systemStartupTime){
|
EmailCounter emailCounter,Date systemStartupTime){
|
||||||
|
@ -50,10 +53,11 @@ public class EmailParsingActuator extends Thread{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (this.isInterrupted()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for(;;){
|
for(;;){
|
||||||
|
if (isStop) {
|
||||||
|
System.out.println("EmailParsingActuator is Stop!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
final EmailServiceManager emailServiceManager = EmailServiceManager.getInstance();
|
final EmailServiceManager emailServiceManager = EmailServiceManager.getInstance();
|
||||||
emailServiceManager.init(this.emailProperties,this.taskProperties.getReceiveNum(),this.taskProperties.getTemporaryStoragePath(),this.systemStartupTime, spectrumServiceQuotes.getSpectrumPathProperties());
|
emailServiceManager.init(this.emailProperties,this.taskProperties.getReceiveNum(),this.taskProperties.getTemporaryStoragePath(),this.systemStartupTime, spectrumServiceQuotes.getSpectrumPathProperties());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user