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

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

Introduction

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

Prototype

@Override
public void close() 

Source Link

Document

Closes the keyed object pool.

Usage

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

public void cleanPool(String tenantName) {
    GenericKeyedObjectPool<PooledLdapConnectionIdentity, ILdapConnectionEx> pool = poolMap
            .remove(tenantName.toLowerCase());
    if (pool != null) {
        pool.close();
        logger.info("Pool closed for tenant " + tenantName);
    }//  www .  j  a va 2 s  .  co m
}

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

public void createPool(String tenantName) {

    GenericKeyedObjectPool<PooledLdapConnectionIdentity, ILdapConnectionEx> newPool = null;
    GenericKeyedObjectPool<PooledLdapConnectionIdentity, ILdapConnectionEx> currentPool = poolMap
            .get(tenantName.toLowerCase());

    if (currentPool == null) {
        newPool = new GenericKeyedObjectPool<>(new PooledLdapConnectionFactory(),
                getGenericKeyedObjectPoolConfig(tenantName));
        currentPool = poolMap.putIfAbsent(tenantName.toLowerCase(), newPool);
        if (currentPool != null) {
            newPool.close();
        }//from  w ww .ja v  a 2  s .c o  m
        logger.info(currentPool != null ? "Pool created for tenant " + tenantName
                : "Pool already existed for tenant " + tenantName);
    }
}