/** * Create a new DelegatingDataSource. * @param targetDataSource the target DataSource */ public DelegatingDataSource(DataSource targetDataSource) { setTargetDataSource(targetDataSource); }
/** * Create a new DelegatingDataSource. * @param targetDataSource the target DataSource */ public DelegatingDataSource(DataSource targetDataSource) { setTargetDataSource(targetDataSource); }
/** * Create a new DelegatingDataSource. * @param targetDataSource the target DataSource */ public DelegatingDataSource(DataSource targetDataSource) { setTargetDataSource(targetDataSource); }
@Override public void reload() throws Exception { // switch data source ComboPooledDataSource oldTargetDataSource = (ComboPooledDataSource)proxyDataSource.getTargetDataSource(); ComboPooledDataSource newTargetDataSource = createNewDataSource(); newTargetDataSource.getConnection().close(); // initialize a connection (+ throw it away) to force the datasource to initialize the pool proxyDataSource.setTargetDataSource(newTargetDataSource); oldTargetDataSource.close(); } });
@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(); } });
@Override public void reload() throws Exception { // switch data source DruidDataSource oldTargetDataSource = (DruidDataSource)proxyDataSource.getTargetDataSource(); DruidDataSource newTargetDataSource = createNewDataSource(); newTargetDataSource.getConnection().close(); // initialize a connection (+ throw it away) to force the datasource to initialize the pool proxyDataSource.setTargetDataSource(newTargetDataSource); oldTargetDataSource.close(); } });
dgds.setTargetDataSource(scds);