本文整理汇总了Java中org.jboss.netty.util.ExternalResourceReleasable类的典型用法代码示例。如果您正苦于以下问题:Java ExternalResourceReleasable类的具体用法?Java ExternalResourceReleasable怎么用?Java ExternalResourceReleasable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExternalResourceReleasable类属于org.jboss.netty.util包,在下文中一共展示了ExternalResourceReleasable类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: destroy
import org.jboss.netty.util.ExternalResourceReleasable; //导入依赖的package包/类
/**
* Destroy the {@link ShareableWorkerPool} and release all resources. After this is called its not usable anymore
*/
public void destroy() {
wrapped.shutdown();
if (wrapped instanceof ExternalResourceReleasable) {
((ExternalResourceReleasable) wrapped).releaseExternalResources();
}
}
示例2: releasePools
import org.jboss.netty.util.ExternalResourceReleasable; //导入依赖的package包/类
private void releasePools() {
if (bossPool instanceof ExternalResourceReleasable) {
((ExternalResourceReleasable) bossPool).releaseExternalResources();
}
if (workerPool instanceof ExternalResourceReleasable) {
((ExternalResourceReleasable) workerPool).releaseExternalResources();
}
}
示例3: releasePools
import org.jboss.netty.util.ExternalResourceReleasable; //导入依赖的package包/类
private void releasePools() {
if (bossPool instanceof ExternalResourceReleasable) {
((ExternalResourceReleasable) bossPool).releaseExternalResources();
}
if (workerPool instanceof ExternalResourceReleasable) {
((ExternalResourceReleasable) workerPool).releaseExternalResources();
}
}
示例4: doStop
import org.jboss.netty.util.ExternalResourceReleasable; //导入依赖的package包/类
@Override
protected void doStop() throws Exception {
LOG.debug("Stopping producer at address: {}", configuration.getAddress());
// close all channels
LOG.trace("Closing {} channels", allChannels.size());
ChannelGroupFuture future = allChannels.close();
future.awaitUninterruptibly();
// release the external resource here and we keep the timer open
// and then shutdown the thread pools
if (bossPool != null) {
bossPool.shutdown();
bossPool = null;
}
if (workerPool != null) {
if (workerPool instanceof ExternalResourceReleasable) {
// this will first invoke workerPool#shutdown() internally (e.g. org.jboss.netty.channel.socket.nio.AbstractNioWorkerPool)
((ExternalResourceReleasable) workerPool).releaseExternalResources();
} else {
workerPool.shutdown();
}
workerPool = null;
}
if (pool != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Stopping producer with channel pool[active={}, idle={}]", pool.getNumActive(), pool.getNumIdle());
}
pool.close();
pool = null;
}
if (channelFactory != null) {
// this will first invoke channelFactory#shutdown() internally (see it's javadoc)
channelFactory.releaseExternalResources();
channelFactory = null;
}
if (datagramChannelFactory != null) {
// this will first invoke datagramChannelFactory#shutdown() internally (see it's javadoc)
datagramChannelFactory.releaseExternalResources();
datagramChannelFactory = null;
}
super.doStop();
}