当前位置: 首页>>代码示例>>Java>>正文


Java GenericObjectPool.close方法代码示例

本文整理汇总了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();
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:25,代码来源:ChannelManager.java

示例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();
  }
}
 
开发者ID:Tencent,项目名称:angel,代码行数:21,代码来源:ChannelManager.java

示例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);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:17,代码来源:HzDataSourceImpl.java

示例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);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:17,代码来源:ThriftDataSourceSupporter.java

示例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);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:14,代码来源:XmppConnectionFactoryImpl.java

示例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);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:14,代码来源:FtpClientConnectionFactoryImpl.java


注:本文中的org.apache.commons.pool.impl.GenericObjectPool.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。