Example usage for org.apache.commons.dbcp ThreadPoolingDataSource getPool

List of usage examples for org.apache.commons.dbcp ThreadPoolingDataSource getPool

Introduction

In this page you can find the example usage for org.apache.commons.dbcp ThreadPoolingDataSource getPool.

Prototype

public ObjectPool getPool() 

Source Link

Usage

From source file:org.apache.cayenne.conf.CustomDBCPDataSourceFactory.java

/**
 *
 *//*from   ww w.j  av a2 s  .  c  o  m*/
@Override
public void tearDown() {
    try {
        DataSource dataSource = CustomDataSourceUtil.getThreadDataSource();
        if (dataSource instanceof ThreadPoolingDataSource) {
            ThreadPoolingDataSource poolingDataSource = (ThreadPoolingDataSource) dataSource;
            if (poolingDataSource != null) {
                ObjectPool pool = poolingDataSource.getPool();
                if (pool != null) {
                    try {
                        pool.close();
                    } catch (Throwable t) {
                        //
                    }
                }
            }
        }
    } catch (Throwable t) {
    }
}