MCPcopy Index your code
hub / github.com/apache/tomcat / close

Method close

java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java:402–421  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

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.

Callers 1

restartMethod · 0.95

Calls 3

getMessageMethod · 0.95
closeMethod · 0.65
unregisterMBeanMethod · 0.45

Tested by

no test coverage detected