Package org.jboss.netty.channel

Examples of org.jboss.netty.channel.ChannelFuture.addListener()


//    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


 
  @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

      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

            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

     
      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

        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

            }

            AbortRequest ar = new AbortRequest();
            ar.startTimestamp = transactionId;
            ChannelFuture f = channel.write(ar);
            f.addListener(new ChannelFutureListener() {
               public void operationComplete(ChannelFuture future) {
                  if (!future.isSuccess()) {
                     error(new IOException("Error writing to socket"));
                  }
               }
View Full Code Here

               createCallbacks.add(cb);
            }

            TimestampRequest tr = new TimestampRequest();
            ChannelFuture f = channel.write(tr);
            f.addListener(new ChannelFutureListener() {
                  public void operationComplete(ChannelFuture future) {
                     if (!future.isSuccess()) {
                        error(new IOException("Error writing to socket"));
                     }
                  }
View Full Code Here

            }
           
            CommitQueryRequest qr = new CommitQueryRequest(startTimestamp,
                                                           pendingWriteTimestamp);
            ChannelFuture f = channel.write(qr);
            f.addListener(new ChannelFutureListener() {
                  public void operationComplete(ChannelFuture future) {
                     if (!future.isSuccess()) {
                        error(new IOException("Error writing to socket"));
                     }
                  }
View Full Code Here

           
            CommitRequest cr = new CommitRequest();
            cr.startTimestamp = transactionId;
            cr.rows = rows;
            ChannelFuture f = channel.write(cr);
            f.addListener(new ChannelFutureListener() {
                  public void operationComplete(ChannelFuture future) {
                     if (!future.isSuccess()) {
                        error(new IOException("Error writing to socket"));
                     }
                  }
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.