#621 - EbeanServer.shutdown(true, false) followed by EbeanServerFactory create() when using the same ServerConfig give SQLException: Trying to access the Connection Pool when it is shutting down

This commit is contained in:
Robin Bygrave
2016-03-25 16:22:11 +13:00
parent 8f80280105
commit ab2789dd08
2 changed files with 13 additions and 3 deletions
@@ -398,9 +398,9 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
*/
private void shutdownInternal(boolean shutdownDataSource, boolean deregisterDriver) {
logger.debug("Shutting down EbeanServer " + getName());
logger.debug("Shutting down EbeanServer {}", serverName);
if (shutdown) {
// Already shutdown
// already shutdown
return;
}
shutdownPlugins();
@@ -411,6 +411,10 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
// shutdown DataSource (if its an Ebean one)
transactionManager.shutdown(shutdownDataSource, deregisterDriver);
shutdown = true;
if (shutdownDataSource) {
// deregister the DataSource in case ServerConfig is re-used
serverConfig.setDataSource(null);
}
}
private void shutdownPlugins() {