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


Java ChannelGroupFuture.awaitUninterruptibly方法代码示例

本文整理汇总了Java中org.jboss.netty.channel.group.ChannelGroupFuture.awaitUninterruptibly方法的典型用法代码示例。如果您正苦于以下问题:Java ChannelGroupFuture.awaitUninterruptibly方法的具体用法?Java ChannelGroupFuture.awaitUninterruptibly怎么用?Java ChannelGroupFuture.awaitUninterruptibly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.netty.channel.group.ChannelGroupFuture的用法示例。


在下文中一共展示了ChannelGroupFuture.awaitUninterruptibly方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stopServerBootstrap

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
protected void stopServerBootstrap() {
    // close all channels
    LOG.info("ConnectionlessBootstrap disconnecting from {}:{}", configuration.getHost(), configuration.getPort());

    LOG.trace("Closing {} channels", allChannels.size());
    ChannelGroupFuture future = allChannels.close();
    future.awaitUninterruptibly();

    // close server external resources
    if (datagramChannelFactory != null) {
        datagramChannelFactory.releaseExternalResources();
        datagramChannelFactory = null;
    }

    // and then shutdown the thread pools
    if (workerPool != null) {
        workerPool.shutdown();
        workerPool = null;
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:SingleUDPNettyServerBootstrapFactory.java

示例2: stopServerBootstrap

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
protected void stopServerBootstrap() {
    // close all channels
    LOG.info("ServerBootstrap unbinding from {}:{}", configuration.getHost(), configuration.getPort());

    LOG.trace("Closing {} channels", allChannels.size());
    ChannelGroupFuture future = allChannels.close();
    future.awaitUninterruptibly();

    // close server external resources
    if (channelFactory != null) {
        channelFactory.releaseExternalResources();
        channelFactory = null;
    }

    // and then shutdown the thread pools
    if (bossPool != null) {
        bossPool.shutdown();
        bossPool = null;
    }
    if (workerPool != null) {
        workerPool.shutdown();
        workerPool = null;
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:25,代码来源:SingleTCPNettyServerBootstrapFactory.java

示例3: stop

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
public void stop() {
    log.info("terminating daemon; closing all channels");

    ChannelGroupFuture future = allChannels.close();
    future.awaitUninterruptibly();
    if (!future.isCompleteSuccess()) {
        throw new RuntimeException("failure to complete closing all network channels");
    }
    log.info("channels closed, freeing cache storage");
    try {
        cache.close();
    } catch (IOException e) {
        throw new RuntimeException("exception while closing storage", e);
    }
    channelFactory.releaseExternalResources();

    running = false;
    log.info("successfully shut down");
}
 
开发者ID:rdaum,项目名称:jmemcache-daemon,代码行数:20,代码来源:MemCacheDaemon.java

示例4: stop

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
public void stop() {
	log.info("terminating daemon; closing all channels");

	ChannelGroupFuture future = allChannels.close();
	future.awaitUninterruptibly();
	if (!future.isCompleteSuccess()) {
		throw new RuntimeException("failure to complete closing all network channels");
	}
	log.info("channels closed, freeing cache storage");
	try {
		cache.close();
	} catch (IOException e) {
		throw new RuntimeException("exception while closing storage", e);
	}
	channelFactory.releaseExternalResources();

	running = false;
	log.info("successfully shut down");
}
 
开发者ID:sunli1223,项目名称:fqueue,代码行数:20,代码来源:MemCacheDaemon.java

示例5: sendServerClosedPacket

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
private void sendServerClosedPacket() {
    logger.info("sendServerClosedPacket start");
    final ChannelGroupFuture write = this.channelGroup.write(new ServerClosePacket());
    write.awaitUninterruptibly(5000, TimeUnit.MILLISECONDS);
    if (logger.isWarnEnabled()) {
        write.addListener(new ChannelGroupFutureListener() {
            private final ChannelFutureListener listener = new WriteFailFutureListener(logger, "serverClosePacket write fail", "serverClosePacket write success");

            @Override
            public void operationComplete(ChannelGroupFuture future) throws Exception {
                for (ChannelFuture channelFuture : future) {
                    channelFuture.addListener(listener);
                }
            }
        });
    }
    logger.info("sendServerClosedPacket end");
}
 
开发者ID:masonmei,项目名称:apm-agent,代码行数:19,代码来源:PinpointServerSocket.java

示例6: main

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {        

        Executor executor = Executors.newCachedThreadPool();
        ChannelFactory factory = new NioServerSocketChannelFactory(executor, executor);
        ServerBootstrap sb = new ServerBootstrap(factory);
        ClientSocketChannelFactory cf = new NioClientSocketChannelFactory(executor, executor);
        sb.setPipelineFactory(new ProxyPipelineFactory(cf,
                RtmpConfig.PROXY_REMOTE_HOST, RtmpConfig.PROXY_REMOTE_PORT));
        InetSocketAddress socketAddress = new InetSocketAddress(RtmpConfig.PROXY_PORT);
        sb.bind(socketAddress);
        logger.info("proxy server started, listening on {}", socketAddress);

        Thread monitor = new StopMonitor(RtmpConfig.PROXY_STOP_PORT);
        monitor.start();
        monitor.join();

        ChannelGroupFuture future = ALL_CHANNELS.close();
        logger.info("closing channels");
        future.awaitUninterruptibly();
        logger.info("releasing resources");
        factory.releaseExternalResources();
        logger.info("server stopped");

    }
 
开发者ID:bruni68510,项目名称:flazr,代码行数:25,代码来源:RtmpProxy.java

示例7: onShutdown

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
protected void onShutdown() {
	/* Close channels */
	final ChannelGroupFuture allChannelsClosed = channelGroup.close();

	/* Stop all mDNS responders */
	synchronized(jmDNSInstances) {
		for(final JmDNS jmDNS: jmDNSInstances) {
			try {
				jmDNS.unregisterAllServices();
				LOG.info("Unregistered all services on " + jmDNS.getInterface());
			}
			catch (final IOException e) {
				LOG.log(Level.WARNING, "Failed to unregister some services", e);
				
			}
		}
	}

	/* Wait for all channels to finish closing */
	allChannelsClosed.awaitUninterruptibly();
	
	/* Stop the ExecutorService */
	executorService.shutdown();

	/* Release the OrderedMemoryAwareThreadPoolExecutor */
	channelExecutionHandler.releaseExternalResources();
	isOn = false;
	
}
 
开发者ID:SergioChan,项目名称:Android-Airplay-Server,代码行数:30,代码来源:AirPlayServer.java

示例8: stopServer

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
@Override
public void stopServer() {
    if (channelGroup != null) {
        ChannelGroupFuture future = channelGroup.close();
        future.awaitUninterruptibly();
    }

    if (bootstrap != null) {
        bootstrap.getFactory().releaseExternalResources();
    }

    if (timer != null) {
        timer.stop();
    }
}
 
开发者ID:sunguangran,项目名称:navi,代码行数:16,代码来源:ANaviTCPServer.java

示例9: destroy

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
public void destroy() throws Exception {
    ChannelGroupFuture future = allChannels.close();
    future.awaitUninterruptibly();
    if (!future.isCompleteSuccess()) {
        throw new RuntimeException("failure to complete closing all network channels");
    }
    try {
        cache.close();
    } catch (IOException e) {
        throw new RuntimeException("exception while closing storage", e);
    }
    channelFactory.releaseExternalResources();
    logger.info("memcached destroyed");
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:15,代码来源:MemCacheDaemon.java

示例10: onShutdown

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
protected void onShutdown() {
	/* Close channels */
	final ChannelGroupFuture allChannelsClosed = channelGroup.close();

	/* Stop all mDNS responders */
	synchronized(jmDNSInstances) {
		for(final JmDNS jmDNS: jmDNSInstances) {
			try {
				jmDNS.unregisterAllServices();
				LogManager.i("Unregistered all services on " + jmDNS.getInterface());
			}
			catch (final IOException e) {
				LogManager.e("Level.WARNING Failed to unregister some services " +Log.getStackTraceString(e));
				
			}
		}
	}

	/* Wait for all channels to finish closing */
	allChannelsClosed.awaitUninterruptibly();
	
	/* Stop the ExecutorService */
	executorService.shutdown();

	/* Release the OrderedMemoryAwareThreadPoolExecutor */
	channelExecutionHandler.releaseExternalResources();
	
}
 
开发者ID:lukeqsun,项目名称:AirSpeakerMobile,代码行数:29,代码来源:AirPlayServer.java

示例11: stop

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
public void stop() {
  ChannelGroupFuture future = channelGroup.close();
  future.awaitUninterruptibly();
  factory.releaseExternalResources();

  LOG.info("HttpDataServer shutdown ("
      + this.bindAddr.getAddress().getHostAddress() + ":"
      + this.bindAddr.getPort() + ")");
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:10,代码来源:HttpDataServer.java

示例12: stop

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
@Override
public void stop()
{
  System.out.println("Shutting down");
  ChannelGroupFuture shutdown = _allChannels.disconnect();
  shutdown.awaitUninterruptibly();
  _bootstrap.releaseExternalResources();
  _executionHandler.releaseExternalResources();
}
 
开发者ID:ppdai,项目名称:rest4j,代码行数:10,代码来源:HttpNettyServer.java

示例13: stop

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
public void stop() {
  try {
    final ChannelGroupFuture closeFuture = myAllOpenChannels.close();
    closeFuture.awaitUninterruptibly();
  }
  finally {
    myChannelFactory.releaseExternalResources();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:JavacServer.java

示例14: main

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        final ChannelFactory factory = new NioServerSocketChannelFactory(
                Executors.newCachedThreadPool(),
                Executors.newCachedThreadPool());

        final ServerBootstrap bootstrap = new ServerBootstrap(factory);

        bootstrap.setPipelineFactory(new ServerPipelineFactory());
        bootstrap.setOption("child.tcpNoDelay", true);
        bootstrap.setOption("child.keepAlive", true);

        final InetSocketAddress socketAddress = new InetSocketAddress(RtmpConfig.SERVER_PORT);
        bootstrap.bind(socketAddress);
        logger.info("server started, listening on: {}", socketAddress);

        final Thread monitor = new StopMonitor(RtmpConfig.SERVER_STOP_PORT);
        monitor.start();        
        monitor.join();

        TIMER.stop();
        final ChannelGroupFuture future = CHANNELS.close();
        logger.info("closing channels");
        future.awaitUninterruptibly();
        logger.info("releasing resources");
        factory.releaseExternalResources();
        logger.info("server stopped");

    }
 
开发者ID:bruni68510,项目名称:flazr,代码行数:30,代码来源:RtmpServer.java

示例15: postStop

import org.jboss.netty.channel.group.ChannelGroupFuture; //导入方法依赖的package包/类
/**
 * stop
 * 
 * Implement this {@link org.shanbo.feluca.common.Server} method
 */
public void postStop() throws Exception {
	ChannelGroupFuture closeFuture = allChannels.close();
	closeFuture.awaitUninterruptibly();
	
	if (channelFactory != null)
		channelFactory.releaseExternalResources();
}
 
开发者ID:lgnlgn,项目名称:feluca,代码行数:13,代码来源:BaseNioServer.java


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