Migliorato shutdown BasicConnectionPool
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user