Example usage for org.apache.commons.pool2.impl GenericObjectPool getMinIdle

List of usage examples for org.apache.commons.pool2.impl GenericObjectPool getMinIdle

Introduction

In this page you can find the example usage for org.apache.commons.pool2.impl GenericObjectPool getMinIdle.

Prototype

@Override
public int getMinIdle() 

Source Link

Document

Returns the target for the minimum number of idle objects to maintain in the pool.

Usage

From source file:org.apache.ofbiz.entity.connection.DebugManagedDataSource.java

@Override
public Connection getConnection() throws SQLException {
    if (Debug.verboseOn()) {
        if (super.getPool() instanceof GenericObjectPool) {
            GenericObjectPool objectPool = (GenericObjectPool) super.getPool();
            Debug.logVerbose("Borrowing a connection from the pool; used/idle/total: "
                    + objectPool.getNumActive() + "/" + objectPool.getNumIdle() + "/"
                    + (objectPool.getNumActive() + objectPool.getNumIdle()) + "; min idle/max idle/max total: "
                    + objectPool.getMinIdle() + "/" + objectPool.getMaxIdle() + "/" + objectPool.getMaxTotal(),
                    module);/*from   w  w  w .  ja  va  2 s. c  o  m*/
        } else {
            Debug.logVerbose("Borrowing a connection from the pool; used/idle/total: "
                    + super.getPool().getNumActive() + "/" + super.getPool().getNumIdle() + "/"
                    + (super.getPool().getNumActive() + super.getPool().getNumIdle()), module);
        }
    }
    return super.getConnection();
}

From source file:org.apache.ofbiz.entity.connection.DebugManagedDataSource.java

public Map<String, Object> getInfo() {
    Map<String, Object> dataSourceInfo = new HashMap<String, Object>();
    dataSourceInfo.put("poolNumActive", super.getPool().getNumActive());
    dataSourceInfo.put("poolNumIdle", super.getPool().getNumIdle());
    dataSourceInfo.put("poolNumTotal", (super.getPool().getNumIdle() + super.getPool().getNumActive()));
    if (super.getPool() instanceof GenericObjectPool) {
        GenericObjectPool objectPool = (GenericObjectPool) super.getPool();
        dataSourceInfo.put("poolMaxActive", objectPool.getMaxTotal());
        dataSourceInfo.put("poolMaxIdle", objectPool.getMaxIdle());
        dataSourceInfo.put("poolMaxWait", objectPool.getMaxWaitMillis());
        dataSourceInfo.put("poolMinEvictableIdleTimeMillis", objectPool.getMinEvictableIdleTimeMillis());
        dataSourceInfo.put("poolMinIdle", objectPool.getMinIdle());
    }//from  w ww.  j  a v a2 s . com
    return dataSourceInfo;
}