List of usage examples for org.apache.commons.dbcp PoolingDriver closePool
public synchronized void closePool(String name) throws SQLException
From source file:com.evanmclean.evlib.commons.dbcp.DbcpUtils.java
/** * Close the specifically named DBCP pool. * /* w w w .j av a 2 s. co m*/ * @param name * The name of the pool to close. * @throws SQLException */ public static void closePool(final String name) throws SQLException { final PoolingDriver driver = getPoolingDriver(); if (driver != null) driver.closePool(name); }
From source file:ManualPoolingDriverExample.java
public static void shutdownDriver() throws Exception { PoolingDriver driver = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:"); driver.closePool("example"); }
From source file:org.apache.avalon.dbcp.DbcpConnectionManager.java
/** * Cleans up the component. //from www . ja v a 2 s .co m */ public void dispose() { try { PoolingDriver driver = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:"); // loop through all the configured datasources... for (int i = 0; i < m_datasources.length; i++) { Configuration datasource = m_datasources[i]; String name = datasource.getAttribute("name"); driver.closePool(name); } } catch (Exception e) { m_logger.warn(e.getMessage()); } }
From source file:org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCachePoolAccess.java
/** * @throws Exception/*from w w w . j ava 2s. c o m*/ */ public void shutdownDriver() throws Exception { PoolingDriver driver = (PoolingDriver) DriverManager.getDriver(DRIVER_NAME); driver.closePool(this.getPoolName()); }
From source file:org.dspace.storage.rdbms.MockDatabaseManager.java
/** * Provide a means for a (web) application to cleanly terminate the connection pool. * @throws SQLException//w w w .j av a 2s. c o m */ @Mock public static synchronized void shutdown() throws SQLException { if (initialized) { initialized = false; // Get the registered DBCP pooling driver PoolingDriver driver = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:"); // Close the named pool if (driver != null) driver.closePool(poolName); } }
From source file:org.eclipse.osee.jdbc.internal.PoolFactory.java
public void disposePools(Iterable<String> keys) { PoolingDriver driver = poolingDriver.get(); for (String key : keys) { try {//from w w w . ja v a2s .c o m driver.closePool(key); } catch (SQLException ex) { // Do Nothing } } poolingDriver.invalidate(); }
From source file:org.infoglue.cms.util.workflow.InfoGlueJDBCPropertySet.java
public void shutdownDriver() throws Exception { PoolingDriver driver = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:"); driver.closePool("infoGlueJDBCPropertySet"); }
From source file:org.openbravo.database.ConnectionProviderImpl.java
public void destroy(String name) throws Exception { PoolingDriver driver = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:"); driver.closePool(name); }
From source file:org.opencms.db.CmsDriverManager.java
/** * Destroys this driver manager and releases all allocated resources.<p> */// ww w . j ava 2s .c om public void destroy() { try { if (m_projectDriver != null) { try { m_projectDriver.destroy(); } catch (Throwable t) { LOG.error(Messages.get().getBundle().key(Messages.ERR_CLOSE_PROJECT_DRIVER_0), t); } m_projectDriver = null; } if (m_userDriver != null) { try { m_userDriver.destroy(); } catch (Throwable t) { LOG.error(Messages.get().getBundle().key(Messages.ERR_CLOSE_USER_DRIVER_0), t); } m_userDriver = null; } if (m_vfsDriver != null) { try { m_vfsDriver.destroy(); } catch (Throwable t) { LOG.error(Messages.get().getBundle().key(Messages.ERR_CLOSE_VFS_DRIVER_0), t); } m_vfsDriver = null; } if (m_historyDriver != null) { try { m_historyDriver.destroy(); } catch (Throwable t) { LOG.error(Messages.get().getBundle().key(Messages.ERR_CLOSE_HISTORY_DRIVER_0), t); } m_historyDriver = null; } if (m_connectionPools != null) { for (int i = 0; i < m_connectionPools.size(); i++) { PoolingDriver driver = m_connectionPools.get(i); String[] pools = driver.getPoolNames(); for (int j = 0; j < pools.length; j++) { try { driver.closePool(pools[j]); if (CmsLog.INIT.isDebugEnabled()) { CmsLog.INIT.debug( Messages.get().getBundle().key(Messages.INIT_CLOSE_CONN_POOL_1, pools[j])); } } catch (Throwable t) { LOG.error( Messages.get().getBundle().key(Messages.LOG_CLOSE_CONN_POOL_ERROR_1, pools[j]), t); } } } m_connectionPools = null; } m_monitor.clearCache(); m_lockManager = null; m_htmlLinkValidator = null; } catch (Throwable t) { // ignore } if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key(Messages.INIT_DRIVER_MANAGER_DESTROY_1, getClass().getName())); } org.opencms.db.jpa.CmsSqlManager.destroy(); }
From source file:org.openpythia.dbconnection.ConnectionPoolUtils.java
/** * Shuts the configurePool poll down and releases all resources *//* w w w . java 2s . c o m*/ public static void shutdownPool() { try { if (hasBeenSuccessfullyConfigured) { PoolingDriver poolingDriver = (PoolingDriver) DriverManager.getDriver(POOL_DRIVER_URL); poolingDriver.closePool(POOL_NAME); } } catch (SQLException e) { throw new RuntimeException(e); } }