Example usage for org.apache.commons.pool2.impl GenericKeyedObjectPool borrowObject

List of usage examples for org.apache.commons.pool2.impl GenericKeyedObjectPool borrowObject

Introduction

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

Prototype

@Override
public T borrowObject(K key) throws Exception 

Source Link

Document

Equivalent to #borrowObject(Object,long) borrowObject (key, #getMaxWaitMillis() ).

Usage

From source file:com.vmware.identity.idm.server.provider.LdapConnectionPool.java

public ILdapConnectionEx borrowConnection(PooledLdapConnectionIdentity identity) throws Exception {
    String tenantName = identity.getTenantName().toLowerCase();

    GenericKeyedObjectPool<PooledLdapConnectionIdentity, ILdapConnectionEx> currentPool = poolMap
            .get(tenantName);/*from   w w w .  j a v a2 s  .  co  m*/

    if (currentPool == null) {
        throw new IllegalStateException("Connection pool does not exist for tenant " + tenantName);
    }

    return currentPool.borrowObject(identity);
}