bbottema/simple-java-mail

Support more advanced batch processing use cases

bbottema opened this issue · 6 comments

Simple Java Mail currently uses threads for handling multiple async send calls, but each thread uses its own Session Transport instance. Unless the actual email payload is huge, creating opening Transport connection to the SMTP server takes about half of the time needed for sending the email.

This issue represents three improvements:

  1. Support Transport connection reuse over multiple threads
  2. Implement an SMTP connection pool so we have multiple reusable Transport connections (including lazy / eager initialization)
  3. Take performance to the next level and support clustered SMTP servers, so you can really scale up using multiple SMPT server if your use case requires it.

Solves #198

To support all these features, I'm looking for a thread-safe Generic Object Pool. My requirements are:

  1. Small code base
  2. Flexible enough to support eager / lazy object initialization and auto-expiry policy
  3. Simple to understand, so I can debug issues myself
  4. Up to date, active maintainer / community
  5. Good documentation, well tested
  6. High performance is nice but of secondary concern since my current use case is an SMTP connection pool

I started out with Stormpot as object pool to implement a new SMTP connection pool library, but it is not flexible enough for this use case (and frankly too opinionated). And really the code is... not how I would like to support it (complicated, custom DSL). That on top of code that is already complex due to performance optimizations.

I now started a new generic object pool which was originally inspired by the old and inactive KBOP but turned out to be a complete rebirth. It shaping out nicely currently so I'll be re-implementing the SMTP connection pool shortly. I'll add project links later on.

I've already implemented the SMPT Connection Pool API and Cluster support in separate (micro) libraries and integrated it in Simple Java Mail, I just need to reintegrate it with the new generic object pool.

I've finished the generic-object-pool, clustered-object-pool and smtp-connection-pool libraries and integrated SNAPSHOT versions of these in Simple Java Mail.

I'm going to release these to Maven soon and then I can finish this Simple Java Mail feature!

Libraries released. Simple Java Mail is now using SMTP Connection Pool successfully. Now I need to make expose the pool's configuration through Simple Java Mail builder API and property files.

After that, provide proper documentation for the website.

Implementation is finished!

Released in 6.0.0-rc1!

6.0.0 has released as well, finally.