You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the connection pool (batch-module enabled), the documentation suggests that the application should call mailer.shutdownConnectionPool() to allow the JVM to shut down.
With Spring Boot (spring-module), beans that implement AutoClosable are normally automatically handled and their close() method is called by the Spring framework upon application shutdown (see Spring documentation).
Therefore, I would expect Mailer to implement AutoClosable, and shut down the connection pool in the close() method, so that shutdown can be automatically handled by Spring Boot (also try-with-resources)
The text was updated successfully, but these errors were encountered:
try-with resource would not be possible in combination with async emails; the connection pool might shut down before the email was sent. However, for closing applications from Spring perspective, this is an interesting thought.
bbottema
changed the title
Let Mailer implement AutoCloseable, to shutdown the connection pool automatically when using Spring
Maintenance: Let Mailer implement AutoCloseable, to shutdown the connection pool automatically when using Spring
Jul 14, 2023
bbottema
changed the title
Maintenance: Let Mailer implement AutoCloseable, to shutdown the connection pool automatically when using Spring
Maintenance: Let Mailer implement AutoCloseable, so it shuts down the connection pool automatically when disposed of by Spring
Jul 14, 2023
…n when Spring wants to shut down the application. Note: this does NOT work with try..with resource in combination with async emails being sent. And using it with try..with resource when not async doesn't make sense, because why have a connection pool in that case.
When using the connection pool (batch-module enabled), the documentation suggests that the application should call mailer.shutdownConnectionPool() to allow the JVM to shut down.
With Spring Boot (spring-module), beans that implement AutoClosable are normally automatically handled and their close() method is called by the Spring framework upon application shutdown (see Spring documentation).
Therefore, I would expect Mailer to implement AutoClosable, and shut down the connection pool in the close() method, so that shutdown can be automatically handled by Spring Boot (also try-with-resources)
The text was updated successfully, but these errors were encountered: