本文整理汇总了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);
}
}