Migliorato shutdown BasicConnectionPool
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good

This commit is contained in:
2025-05-22 10:03:56 +02:00
parent 8f2b71fc90
commit 4cd960ffc5

View File

@@ -36,6 +36,8 @@ public class BasicConnectionPool {
private final ReentrantLock poolLock = new ReentrantLock();
private boolean shuttingDown = false;
public void init() throws Exception {
poolLock.lock();
try {
@@ -50,6 +52,7 @@ public class BasicConnectionPool {
@PreDestroy
public void destroy() {
logger.info("Shutting down connection pool");
shuttingDown = true;
closeAllConnections();
logger.info("Connection pool shut down successfully");
}
@@ -177,7 +180,7 @@ public class BasicConnectionPool {
poolLock.lock();
try {
String currentCatalog = ds.getConnection().getCatalog();
String currentCatalog = shuttingDown ? ds.getDbName() : ds.getConnection().getCatalog();
AvailableConnectionsModel model = findConnectionModel(profileName);
if (model == null) {
@@ -189,7 +192,7 @@ public class BasicConnectionPool {
return false;
}
return handleConnectionRelease(ds);
return shuttingDown || handleConnectionRelease(ds);
} finally {
poolLock.unlock();
}