Example usage for org.apache.commons.pool2.impl DefaultPooledObjectInfo DefaultPooledObjectInfo

List of usage examples for org.apache.commons.pool2.impl DefaultPooledObjectInfo DefaultPooledObjectInfo

Introduction

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

Prototype

public DefaultPooledObjectInfo(PooledObject<?> pooledObject) 

Source Link

Document

Create a new instance for the given pooled object.

Usage

From source file:JDBCPool.dbcp.demo.sourcecode.GenericObjectPool.java

/**
 * Provides information on all the objects in the pool, both idle (waiting
 * to be borrowed) and active (currently borrowed).
 * <p>/*from ww  w. ja va  2s  .com*/
 * Note: This is named listAllObjects so it is presented as an operation via
 * JMX. That means it won't be invoked unless the explicitly requested
 * whereas all attributes will be automatically requested when viewing the
 * attributes for an object in a tool like JConsole.
 *
 * @return Information grouped on all the objects in the pool
 */
@Override
public Set<DefaultPooledObjectInfo> listAllObjects() {
    Set<DefaultPooledObjectInfo> result = new HashSet<DefaultPooledObjectInfo>(allObjects.size());
    for (PooledObject<T> p : allObjects.values()) {
        result.add(new DefaultPooledObjectInfo(p));
    }
    return result;
}