Мое приложение прослушивает несколько таблиц, используя Oracle UCP. В производственной среде приложение работает нормально, но в тестовой среде у приложения заканчиваются соединения из пула. Я закрываю и возвращаю использованные соединения в каждом запросе. Пожалуйста, обратитесь к методу закрытия соединения.
public static synchronized void closeConnection(Connection con) throws Exception {
String print;
try {
if (con != null && !con.isClosed()) {
con.close();
con =null;
Config.DB_POOL_COUNT_AVAILABLE = pds.getAvailableConnectionsCount();
Config.DB_POOL_COUNT_BUSSY = pds.getBorrowedConnectionsCount();
Config.DB_POOL_COUNT_OPENED = Config.DB_POOL_COUNT_AVAILABLE + Config.DB_POOL_COUNT_BUSSY;
} else {
Config.DB_POOL_COUNT_AVAILABLE = pds.getAvailableConnectionsCount();
Config.DB_POOL_COUNT_BUSSY = pds.getBorrowedConnectionsCount();
Config.DB_POOL_COUNT_OPENED = Config.DB_POOL_COUNT_AVAILABLE + Config.DB_POOL_COUNT_BUSSY;
}
} catch (Exception e) {
Logger.errorLog(e);
} finally {
Config.DB_POOL_COUNT_AVAILABLE = pds.getAvailableConnectionsCount();
Config.DB_POOL_COUNT_BUSSY = pds.getBorrowedConnectionsCount();
Config.DB_POOL_COUNT_OPENED = Config.DB_POOL_COUNT_AVAILABLE + Config.DB_POOL_COUNT_BUSSY;
if(con != null && !con.isClosed()){
con.close();
con=null;
}
}
}