public static void destroyDataSources ( ) { synchronized ( dataSourcesStructureLock ) { for ( Map . Entry < String , DataSource > dsEntry : dataSources . entrySet ( ) ) { String dsName = dsEntry . getKey ( ) ; DataSource ds = dsEntry . getValue ( ) ; for ( Map . Entry < String , DataSourceProvider > dspEntry : dataSourceProviders . entrySet ( ) ) { // try them one by one String dspName = dspEntry . getKey ( ) ; DataSourceProvider dsp = dspEntry . getValue ( ) ; try { if ( dsp . destroyDataSource ( ds ) ) { break ; } } catch ( NoClassDefFoundError e ) { // ignore } catch ( Throwable e ) { log . error ( "Error when destroying data source '" + dsName + "' using provider '" + dspName + "'" , e ) ; } } } dataSources . clear ( ) ; } }
Destroy all the data sources created before . If any exception occurred it will be logged but never propagated .