Examples of ChannelFutureListener


Examples of org.jboss.netty.channel.ChannelFutureListener

        if (LOG.isTraceEnabled()) {
            LOG.trace("Waiting for operation to complete {} for {} millis", channelFuture, configuration.getConnectTimeout());
        }
        // here we need to wait it in other thread
        final CountDownLatch channelLatch = new CountDownLatch(1);
        channelFuture.addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture cf) throws Exception {
                channelLatch.countDown();
            }
        });
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

      }
     
      ChannelFuture future = bootstrap.connect(new InetSocketAddress(host,
          port));
     
      future.addListener(new ChannelFutureListener()
      {
        @Override
        public void operationComplete(ChannelFuture future) throws Exception
        {
          ChannelBuffer loginBuffer = getLoginBuffer("Zombie_ROOM_1_REF_KEY_1",writeSocketAddressToBuffer(udpLocalAddress));
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

        // Write the connect statement. TODO repeat till we get start.
        System.out.println("Events.CONNECT: " + Events.CONNECT);
        ChannelBuffer buf = NettyUtils.createBufferForOpcode(Events.CONNECT);
       
        ChannelFuture future = c.write(buf, serverAddress);
        future.addListener(new ChannelFutureListener()
        {
          @Override
          public void operationComplete(ChannelFuture future) throws Exception
          {
            if(!future.isSuccess())
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

//    try {
//      channelFuture.await(10, TimeUnit.SECONDS);
//    } catch (InterruptedException e) {
//    }
   
    channelFuture.addListener(new ChannelFutureListener() {
          public void operationComplete(ChannelFuture future) {
              if(future.isSuccess()) {
                  //warn的日志,打点为了对每轮执行情况进行观察
                  if (logger.isWarnEnabled())
                  {
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

//    try {
//      channelFuture.await(10, TimeUnit.SECONDS);
//    } catch (InterruptedException e) {
//    }
   
    channelFuture.addListener(new ChannelFutureListener() {
          public void operationComplete(ChannelFuture future) {
              if (!future.isSuccess())
              {
                logger.error("Mastersocket write error.",future.getCause());
                  future.getChannel().close();
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

 
  @Override
  public void echoSendMonitorInfo(SendMonitorInfoResponseEvent event) {
   
    ChannelFuture channelFuture = ((Channel)event.getChannel()).write(event);
    channelFuture.addListener(new ChannelFutureListener() {
          public void operationComplete(ChannelFuture future) {
              if (!future.isSuccess())
              {
                logger.error("Mastersocket write error.",future.getCause());
                  future.getChannel().close();
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

      ChannelFuture channelFuture = channel.write(requestEvent);

      // why ??, 这里不必等待
      //channelFuture.await(10, TimeUnit.SECONDS);

      channelFuture.addListener(new ChannelFutureListener() {
        public void operationComplete(ChannelFuture future) {
          if (!future.isSuccess()) {
            responseQueue.remove(event.getSequence());
//            slaveEventTimeQueue.remove(event);
           
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

            jobResponseEvent.setChannel(channel);
            final long start = System.currentTimeMillis();
            ChannelFuture channelFuture = channel.write(jobResponseEvent);
//            channelFuture.await(10, TimeUnit.SECONDS);

            channelFuture.addListener(new ChannelFutureListener() {
                public void operationComplete(ChannelFuture future) {
                    if (!future.isSuccess()) {
                        responseQueue.remove(event.getSequence());
//                        slaveEventTimeQueue.remove(event);
                       
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

     
      Channel channel = getChannel(leaderChannel);
      sendSlaveMonitorInfoEvent.setChannel(channel);
      ChannelFuture channelFuture = channel.write(sendSlaveMonitorInfoEvent);

      channelFuture.addListener(new ChannelFutureListener() {
        public void operationComplete(ChannelFuture future) {
          if (!future.isSuccess()) {
            responseQueue.remove(event.getSequence());
            logger.error("Slavesocket write error when trying to get tasks from master.", future.getCause());
            future.getChannel().close();
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

        if (requests == null)
            return;

        pendings.incrementAndGet();
        ChannelFuture future = channel.write(requests);
        future.addListener(new ChannelFutureListener() {
            public void operationComplete(ChannelFuture future)
                    throws Exception {

                pendings.decrementAndGet();
                if (!future.isSuccess()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.