Closes and releases all idle connections that are currently stored in the connection pool associated with this data source. Connections that are checked out to clients when this method is invoked are not affected. When client applications subsequently invoke Connection#close() to return
()
| 400 | * @throws SQLException if an error occurs closing idle connections |
| 401 | */ |
| 402 | @Override |
| 403 | public synchronized void close() throws SQLException { |
| 404 | if (registeredJmxObjectName != null) { |
| 405 | registeredJmxObjectName.unregisterMBean(); |
| 406 | registeredJmxObjectName = null; |
| 407 | } |
| 408 | closed = true; |
| 409 | final GenericObjectPool<?> oldPool = connectionPool; |
| 410 | connectionPool = null; |
| 411 | dataSource = null; |
| 412 | try { |
| 413 | if (oldPool != null) { |
| 414 | oldPool.close(); |
| 415 | } |
| 416 | } catch (final RuntimeException e) { |
| 417 | throw e; |
| 418 | } catch (final Exception e) { |
| 419 | throw new SQLException(Utils.getMessage("pool.close.fail"), e); |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | /** |
| 424 | * Closes the connection pool, silently swallowing any exception that occurs. |
no test coverage detected