本文整理匯總了Java中org.apache.commons.pool.impl.GenericObjectPool.close方法的典型用法代碼示例。如果您正苦於以下問題:Java GenericObjectPool.close方法的具體用法?Java GenericObjectPool.close怎麽用?Java GenericObjectPool.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.pool.impl.GenericObjectPool
的用法示例。
在下文中一共展示了GenericObjectPool.close方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: refreshChannelPool
import org.apache.commons.pool.impl.GenericObjectPool; //導入方法依賴的package包/類
/**
* Refresh the channel pool for the server.
*
* @param loc server address
*/
public void refreshChannelPool(Location loc) {
try {
lock.lock();
GenericObjectPool<Channel> pool = locToChannelPoolMap.get(loc);
if(pool == null) {
return;
} else {
try {
pool.close();
} catch (Exception e) {
LOG.error("Close channel for location " + loc +" error ", e);
}
}
locToChannelPoolMap.put(loc, createPool(loc, pool.getNumActive() / 5));
} finally {
lock.unlock();
}
}
示例2: removeChannelPool
import org.apache.commons.pool.impl.GenericObjectPool; //導入方法依賴的package包/類
/**
* Remove the channel pool for the server.
*
* @param loc server address
*/
public void removeChannelPool(Location loc) {
try {
lock.lock();
GenericObjectPool<Channel> pool = locToChannelPoolMap.remove(loc);
if (pool != null) {
try {
pool.close();
} catch (Exception e) {
e.printStackTrace();
}
}
} finally {
lock.unlock();
}
}
示例3: close
import org.apache.commons.pool.impl.GenericObjectPool; //導入方法依賴的package包/類
public synchronized void close() throws ZooKeeperConnectionException {
if (this.closed) {
throw new ZooKeeperConnectionException("HzDataSource was already closed");
}
//
this.closed = true;
GenericObjectPool<HConnection> oldpool = this.objectPool;
this.objectPool = null;
this.instance = null;
try {
if (oldpool != null)
oldpool.close();
} catch (Exception ex) {
throw new ZooKeeperConnectionException("Cannot close pool", ex);
}
}
示例4: close
import org.apache.commons.pool.impl.GenericObjectPool; //導入方法依賴的package包/類
public synchronized void close() throws TTransportException {
if (this.closed) {
throw new TTransportException(dataSourceType + " was already closed");
}
//
this.closed = true;
GenericObjectPool<TTransport> oldpool = this.objectPool;
this.objectPool = null;
this.instance = null;
try {
if (oldpool != null)
oldpool.close();
} catch (Exception e) {
throw new TTransportException("Cannot close pool", e);
}
}
示例5: close
import org.apache.commons.pool.impl.GenericObjectPool; //導入方法依賴的package包/類
public synchronized void close() throws IOException {
this.closed = true;
GenericObjectPool<XMPPConnection> oldpool = this.objectPool;
this.objectPool = null;
this.instance = null;
try {
if (oldpool != null) {
oldpool.close();
}
} catch (Exception ex) {
throw new IOException("Cannot close pool", ex);
}
}
示例6: close
import org.apache.commons.pool.impl.GenericObjectPool; //導入方法依賴的package包/類
public synchronized void close() throws IOException {
this.closed = true;
GenericObjectPool<FTPClient> oldpool = this.objectPool;
this.objectPool = null;
this.instance = null;
try {
if (oldpool != null) {
oldpool.close();
}
} catch (Exception ex) {
throw new IOException("Cannot close pool", ex);
}
}