protected DataSource getDataSource ( JdbcConnectionDescriptor jcd ) throws LookupException { final PBKey key = jcd . getPBKey ( ) ; DataSource ds = ( DataSource ) dsMap . get ( key ) ; if ( ds == null ) { // Found no pool for PBKey try { synchronized ( poolSynch ) { // Setup new object pool ObjectPool pool = setupPool ( jcd ) ; poolMap . put ( key , pool ) ; // Wrap the underlying object pool as DataSource ds = wrapAsDataSource ( jcd , pool ) ; dsMap . put ( key , ds ) ; } } catch ( Exception e ) { log . error ( "Could not setup DBCP DataSource for " + jcd , e ) ; throw new LookupException ( e ) ; } } return ds ; }
Returns the DBCP DataSource for the specified connection descriptor after creating a new DataSource if needed .