I am trying to configure different corePoolSize for 2 Mailer instances, but so far without success. As i understand from documentation, all i need is to define different clusterKey for each Mailer. But it doesn`t work as I expect. I also use batch-module.
@Bean(name = FIRST_SERVER_HOST)
public Mailer mailerFirst() {
return MailerBuilder
.withSMTPServer(FIRST_SERVER_HOST, FIRST_SERVER_PORT)
.async()
.withThreadPoolSize(20)
.withConnectionPoolCoreSize(1)
.withClusterKey(UUID.randomUUID())
.buildMailer();
}
@Bean(name = SECOND_SERVER_HOST)
public Mailer mailerSecond() {
return MailerBuilder
.withSMTPServer(SECOND_SERVER_HOST, SECOND_SERVER_PORT)
.async()
.withThreadPoolSize(20)
.withConnectionPoolCoreSize(0)
.withClusterKey(UUID.randomUUID())
.buildMailer();
}
I am trying to configure different corePoolSize for 2 Mailer instances, but so far without success. As i understand from documentation, all i need is to define different clusterKey for each Mailer. But it doesn`t work as I expect. I also use batch-module.
simple-java-mail/modules/batch-module/src/main/java/org/simplejavamail/internal/batchsupport/BatchSupport.java
Lines 84 to 91 in 375bbd6
https://github.com/bbottema/clustered-object-pool/blob/5857ced611c5be3489cd3cb763bfce8421aab9d9/src/main/java/org/bbottema/clusteredobjectpool/core/ResourceClusters.java#L55
My config: