Search in sources :

Example 1 with ChannelGroupFuture

use of org.jboss.netty.channel.group.ChannelGroupFuture in project weave by continuuity.

the class ConnectionPool method close.

ChannelGroupFuture close() {
    ChannelGroupFuture result = channelGroup.close();
    result.addListener(new ChannelGroupFutureListener() {

        @Override
        public void operationComplete(ChannelGroupFuture future) throws Exception {
            bootstrap.releaseExternalResources();
        }
    });
    return result;
}
Also used : ChannelGroupFuture(org.jboss.netty.channel.group.ChannelGroupFuture) ChannelGroupFutureListener(org.jboss.netty.channel.group.ChannelGroupFutureListener)

Example 2 with ChannelGroupFuture

use of org.jboss.netty.channel.group.ChannelGroupFuture in project pinpoint by naver.

the class PinpointServerAcceptor method sendPing.

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);
}
Also used : TimerTask(org.jboss.netty.util.TimerTask) Timeout(org.jboss.netty.util.Timeout) ChannelGroupFuture(org.jboss.netty.channel.group.ChannelGroupFuture) ChannelGroupFutureListener(org.jboss.netty.channel.group.ChannelGroupFutureListener) WriteFailFutureListener(com.navercorp.pinpoint.rpc.client.WriteFailFutureListener) PinpointSocketException(com.navercorp.pinpoint.rpc.PinpointSocketException)

Example 3 with ChannelGroupFuture

use of org.jboss.netty.channel.group.ChannelGroupFuture in project camel by apache.

the class SingleTCPNettyServerBootstrapFactory method stopServerBootstrap.

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;
    }
}
Also used : ChannelGroupFuture(org.jboss.netty.channel.group.ChannelGroupFuture)

Example 4 with ChannelGroupFuture

use of org.jboss.netty.channel.group.ChannelGroupFuture in project camel by apache.

the class SingleUDPNettyServerBootstrapFactory method stopServerBootstrap.

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;
    }
}
Also used : ChannelGroupFuture(org.jboss.netty.channel.group.ChannelGroupFuture)

Example 5 with ChannelGroupFuture

use of org.jboss.netty.channel.group.ChannelGroupFuture in project bigbluebutton by bigbluebutton.

the class SocketClient method stop.

public void stop() {
    ChannelGroupFuture future = allChannels.close();
    future.awaitUninterruptibly();
    channelFactory.releaseExternalResources();
    log.info("SocketClient stopped");
}
Also used : ChannelGroupFuture(org.jboss.netty.channel.group.ChannelGroupFuture)

Aggregations

ChannelGroupFuture (org.jboss.netty.channel.group.ChannelGroupFuture)6 ChannelGroupFutureListener (org.jboss.netty.channel.group.ChannelGroupFutureListener)2 PinpointSocketException (com.navercorp.pinpoint.rpc.PinpointSocketException)1 WriteFailFutureListener (com.navercorp.pinpoint.rpc.client.WriteFailFutureListener)1 ExternalResourceReleasable (org.jboss.netty.util.ExternalResourceReleasable)1 Timeout (org.jboss.netty.util.Timeout)1 TimerTask (org.jboss.netty.util.TimerTask)1