Example usage for org.apache.commons.pool2 ObjectPool clear

List of usage examples for org.apache.commons.pool2 ObjectPool clear

Introduction

In this page you can find the example usage for org.apache.commons.pool2 ObjectPool clear.

Prototype

void clear() throws Exception, UnsupportedOperationException;

Source Link

Document

Clears any objects sitting idle in the pool, releasing any associated resources (optional operation).

Usage

From source file:com.yahoo.athenz.common.server.db.AthenzDataSource.java

@Override
synchronized public void clearPoolConnections() {
    ObjectPool<PoolableConnection> pool = getPool();
    try {// w ww.  ja v  a  2s  . c o m
        if (LOG.isDebugEnabled()) {
            LOG.debug("Clearing all active/idle (" + pool.getNumActive() + "/" + pool.getNumIdle()
                    + ") connections from the pool");
        }
        pool.clear();
    } catch (Exception ex) {
        LOG.error("Unable to clear connections from the pool: " + ex.getMessage());
    }
}