本文整理汇总了Java中org.jboss.netty.channel.group.ChannelGroupFuture类的典型用法代码示例。如果您正苦于以下问题:Java ChannelGroupFuture类的具体用法?Java ChannelGroupFuture怎么用?Java ChannelGroupFuture使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChannelGroupFuture类属于org.jboss.netty.channel.group包,在下文中一共展示了ChannelGroupFuture类的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;
}
}
示例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;
}
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}
示例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;
}
示例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();
}
}
示例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");
}
示例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();
}
示例11: sendPing
import org.jboss.netty.channel.group.ChannelGroupFuture; //导入依赖的package包/类
private void sendPing() {
logger.debug("sendPing");
final TimerTask pintTask = new TimerTask() {
@Override
public void run(Timeout timeout) throws Exception {
if (timeout.isCancelled()) {
newPingTimeout(this);
return;
}
final ChannelGroupFuture write = channelGroup.write(PingPacket.PING_PACKET);
if (logger.isWarnEnabled()) {
write.addListener(new ChannelGroupFutureListener() {
private final ChannelFutureListener listener = new WriteFailFutureListener(logger, "ping write fail", "ping write success");
@Override
public void operationComplete(ChannelGroupFuture future) throws Exception {
if (logger.isWarnEnabled()) {
for (ChannelFuture channelFuture : future) {
channelFuture.addListener(listener);
}
}
}
});
}
newPingTimeout(this);
}
};
newPingTimeout(pintTask);
}
示例12: 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() + ")");
}
示例13: 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();
}
示例14: stop
import org.jboss.netty.channel.group.ChannelGroupFuture; //导入依赖的package包/类
public void stop() {
try {
final ChannelGroupFuture closeFuture = myAllOpenChannels.close();
closeFuture.awaitUninterruptibly();
}
finally {
myChannelFactory.releaseExternalResources();
}
}
示例15: 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");
}