DelegatingDataSource getTargetDataSource - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for DelegatingDataSource getTargetDataSource method.

This code example shows how to use the following methods:getTargetDataSource, setTargetDataSource
	 * @param newConfig BoneCP DataSource to use. 
	 * @throws SQLException 
	public void switchDataSource(BoneCPConfig newConfig) throws SQLException {"Switch to new datasource requested. New Config: "+newConfig);
		DataSource oldDS = getTargetDataSource();
		if (!(oldDS instanceof BoneCPDataSource)){
			throw new SQLException("Unknown datasource type! Was expecting BoneCPDataSource but received "+oldDS.getClass()+". Not switching datasource!");
		BoneCPDataSource newDS = new BoneCPDataSource(newConfig);
		newDS.getConnection().close(); // initialize a connection (+ throw it away) to force the datasource to initialize the pool
		// force application to start using the new one  
		setTargetDataSource(newDS);"Shutting down old datasource slowly. Old Config: "+oldDS);
		// tell the old datasource to terminate. This terminates the pool lazily so existing checked out connections can still be used. 
getTargetDataSource Method Overview
Return the target DataSource that this DataSource should delegate to.
See Code Examples for other Spring Framework DelegatingDataSource Methods: