Search in sources :

Example 1 with WriteFailFutureListener

use of com.navercorp.pinpoint.rpc.client.WriteFailFutureListener 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)

Aggregations

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