@Override public void close(DataSource dataSource) throws SQLException { if (dataSource instanceof BoneCPDataSource) { ((BoneCPDataSource) dataSource).close(); } } }
@Override protected void passivateDataSourcePool( BoneCPDataSource dataSourcePool ) throws Exception { dataSourcePool.close(); }
@Override public void destroy() throws Exception { this.dataSource.close(); } }
public void close() { dataSource.close(); } public DataSource getDataSource()
@Override protected void passivateDataSourcePool( BoneCPDataSource dataSourcePool ) throws Exception { dataSourcePool.close(); }
@Override protected void passivateDataSourcePool( BoneCPDataSource dataSourcePool ) throws Exception { dataSourcePool.close(); }
@Override protected void destroyInstance(DataSource instance) throws Exception { ((BoneCPDataSource)((DelegatingDataSource)instance).getTargetDataSource()).close(); }
@Override public void shutdown() { BoneCPDataSource oldInstance = instance.getAndSet(null); try { oldInstance.close(); } catch (Exception e) { throw Throwables.propagate(e); } } });
private void shutdownPool(WrappedDataSource source) { if (source.getWrapped() instanceof BoneCPDataSource) { ((BoneCPDataSource) source.getWrapped()).close(); } else { throw new IllegalArgumentException("Cannot close a data source not managed by the manager :" + source); } }
@Override public void reload() throws Exception { // switch data source BoneCPDataSource oldTargetDataSource = (BoneCPDataSource)proxyDataSource.getTargetDataSource(); BoneCPDataSource newTargetDataSource = createNewDataSource(); newTargetDataSource.getConnection().close(); // initialize a connection (+ throw it away) to force the datasource to initialize the pool proxyDataSource.setTargetDataSource(newTargetDataSource); oldTargetDataSource.close(); } });