public void close() { try { dataSource.close(); } catch (Exception e) { throw new RuntimeException(e); } }
/** * To close the adaptor, because we need to close all connections on this JDBC source. * @throws IOException If close failed. */ @Override public void close() throws IOException { try { dataSource.close(); } catch (SQLException e) { throw new IllegalStateException(e); } }
public void close() { try { ((org.apache.commons.dbcp.BasicDataSource) dataSource).close(); } catch (SQLException e) { logger.error("error closing data source", e); } } }
/** * Closes the connections to the database. * * @throws SQLException */ public void close() throws SQLException { ( (BasicDataSource) dataSource ).close(); }
public void close() { try { this.dataSource.close(); } catch(SQLException e) { throw new VoldemortException("Exception while closing connection pool.", e); } }
@Override public synchronized void close() throws SQLException { super.close(); if (this.tunnel != null) { this.tunnel.close(); } } }
@AfterClass public void cleanUp() throws Exception { basicDataSource.close(); }
/** * Shutdown pool, close all open connections. */ @OnDisabled public void shutdown() { try { dataSource.close(); } catch (final SQLException e) { throw new ProcessException(e); } }
/** * Shutdown pool, close all open connections. */ @OnDisabled public void shutdown() { try { dataSource.close(); } catch (final SQLException e) { throw new ProcessException(e); } }
public void close() throws SQLException { ((BasicDataSource) wrapped).close(); }
/** * Closes the geopackage database connection. * * <p>The application should always call this method when done with a geopackage to prevent * connection leakage. */ public void close() { if (dataStore != null) { dataStore.dispose(); } try { if (connPool instanceof BasicDataSource) { ((BasicDataSource) connPool).close(); } else if (connPool instanceof ManageableDataSource) { ((ManageableDataSource) connPool).close(); } } catch (SQLException e) { LOGGER.log(Level.WARNING, "Error closing database connection", e); } }
/** * Closes the mbtiles database connection. * * <p>The application should always call this method when done with a mbtiles to prevent * connection leakage. */ public void close() { if (dataStore != null) { dataStore.dispose(); } try { if (connPool instanceof BasicDataSource) { ((BasicDataSource) connPool).close(); } else if (connPool instanceof ManageableDataSource) { ((ManageableDataSource) connPool).close(); } } catch (SQLException e) { LOGGER.log(Level.WARNING, "Error closing database connection", e); } }
@Override public void onRemoval(@Nonnull final RemovalNotification<com.thinkbiganalytics.db.DataSourceProperties, DataSource> notification) { // Release DataSource resources final DataSource dataSource = notification.getValue(); try { if (dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource) { ((org.apache.tomcat.jdbc.pool.DataSource) dataSource).close(); } else if (dataSource instanceof org.apache.commons.dbcp2.BasicDataSource) { ((org.apache.commons.dbcp2.BasicDataSource) dataSource).close(); } else if (dataSource instanceof org.apache.commons.dbcp.BasicDataSource) { ((org.apache.commons.dbcp.BasicDataSource) dataSource).close(); } } catch (final SQLException e) { log.debug("Failed to close DataSource: {}: {}", dataSource, e); } // Release DataSourceProperties resources final ClassLoader classLoader = (notification.getKey() != null) ? notification.getKey().getDriverClassLoader() : null; if (classLoader instanceof Closeable) { try { ((Closeable) classLoader).close(); } catch (final IOException e) { log.debug("Failed to close ClassLoader for driver: {}: {}", notification.getKey().getDriverClassName(), e); } } }
@Override public void tearDown() throws Exception { try { if (dataSource != null) { dataSource.close(); } super.tearDown(); } finally { System.clearProperty(Context.INITIAL_CONTEXT_FACTORY); GeoTools.clearInitialContext(); } }
public void tearDown() throws Exception { final String leakMessage = "Expected no active connection, either there is a connection leak " + "or you forgot to close some object holding onto connections in the tests (e.g., a reader, an iterator)"; if (dataSource instanceof BasicDataSource) { BasicDataSource bds = (BasicDataSource) dataSource; assertEquals(leakMessage, 0, bds.getNumActive()); } else if (dataSource instanceof DBCPDataSource) { BasicDataSource bds = (BasicDataSource) ((DBCPDataSource) dataSource).getWrapped(); assertEquals(leakMessage, 0, bds.getNumActive()); } if (dataSource instanceof BasicDataSource) { BasicDataSource bds = (BasicDataSource) dataSource; bds.close(); } else if (dataSource instanceof ManageableDataSource) { ((ManageableDataSource) dataSource).close(); } }
@Override public void close(SingleDataSource singleDataSource, boolean forceClose) throws SQLException { String dsId = singleDataSource.getId(); LOGGER.info(singleDataSource.getAndIncrementCloseAttempt() + " attempt to close datasource [" + dsId + "]"); if (forceClose) { LOGGER.info("closing old datasource [" + dsId + "]"); pool.close(); LOGGER.info("old datasource [" + dsId + "] closed"); singleDataSource.setState(DataSourceState.CLOSED); } else { if (pool.getNumActive() == 0 || singleDataSource.getCloseAttempt() >= MAX_CLOSE_ATTEMPT) { LOGGER.info("closing old datasource [" + dsId + "]"); pool.close(); LOGGER.info("old datasource [" + dsId + "] closed"); singleDataSource.setState(DataSourceState.CLOSED); } else { throwException(dsId); } } }
@Override protected void doDestroy(final CommonDataSource dataSource) throws Throwable { ((org.apache.commons.dbcp.BasicDataSource) dataSource).close(); } }
public void close() { try { ((org.apache.commons.dbcp.BasicDataSource) dataSource).close(); } catch (SQLException e) { logger.error("error closing data source", e); } } }
public void closeDataSource() { try { ((BasicDataSource) getDataSource()).close(); } catch (SQLException e) { // do nothing } } }