Skip to content

Commit

Permalink
#204: started moving concurrent helper classes to a separate package
Browse files Browse the repository at this point in the history
  • Loading branch information
bbottema committed Apr 27, 2019
1 parent 9bc467f commit 9b8504f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.simplejavamail.email.Recipient;
import org.simplejavamail.mailer.MailerGenericBuilder;
import org.simplejavamail.mailer.config.TransportStrategy;
import org.simplejavamail.mailer.internal.mailsender.concurrent.NamedRunnable;
import org.simplejavamail.mailer.internal.socks.AuthenticatingSocks5Bridge;
import org.simplejavamail.mailer.internal.socks.SocksProxyConfig;
import org.simplejavamail.mailer.internal.socks.socks5server.AnonymousSocks5Server;
Expand Down Expand Up @@ -196,16 +197,11 @@ the proxy bridge server (or connection pool in async mode) while a non-async ema
executor = Executors.newFixedThreadPool(operationalConfig.getThreadPoolSize());
}
configureSessionWithTimeout(session, operationalConfig.getSessionTimeout());
executor.execute(new Runnable() {
executor.execute(new NamedRunnable("sendMail process") {
@Override
public void run() {
sendMailClosure(session, email);
}

@Override
public String toString() {
return "sendMail process";
}
});
} else {
sendMailClosure(session, email);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.simplejavamail.mailer.internal.mailsender.concurrent;

public abstract class NamedRunnable implements Runnable {

private final String name;

public NamedRunnable(String name) {
this.name = name;
}

@Override
public String toString() {
return name;
}
}

0 comments on commit 9b8504f

Please sign in to comment.