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


Java ExternalResourceReleasable类代码示例

本文整理汇总了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();
    }
}
 
开发者ID:nyankosama,项目名称:simple-netty-source,代码行数:10,代码来源:ShareableWorkerPool.java

示例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();
    }
}
 
开发者ID:nyankosama,项目名称:simple-netty-source,代码行数:9,代码来源:NioClientSocketChannelFactory.java

示例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();
	}
}
 
开发者ID:urunimi,项目名称:android-netty,代码行数:9,代码来源:NioClientSocketChannelFactory.java

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


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