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

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

Introduction

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

Prototype

public T borrowObject(long borrowMaxWaitMillis) throws Exception 

Source Link

Document

Borrow an object from the pool using the specific waiting time which only applies if #getBlockWhenExhausted() is true.

Usage

From source file:com.axibase.tsd.client.HttpClientManager.java

private HttpClient borrowClient() {
    GenericObjectPool<HttpClient> objectPool = createObjectPool();
    HttpClient httpClient;/*  w w w . ja  va2s. com*/
    try {
        httpClient = objectPool.borrowObject(borrowMaxWaitMillis);
    } catch (Exception e) {
        throw new AtsdClientException("Could not borrow http client from pool", e);
    }
    return httpClient;
}