Examples of ChannelFutureListener


Examples of org.jboss.netty.channel.ChannelFutureListener

      if (host == null) {
         throw new IOException("tso.host missing from configuration");
      }

      bootstrap.connect(new InetSocketAddress(host, port)).addListener(new ChannelFutureListener() {
        
         @Override
         public void operationComplete(ChannelFuture future) throws Exception {
            if (future.isSuccess()) {
               System.out.println("Compacter connected!");
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

            IOException e = new IOException("Max connection retries exceeded");
            bailout(e);
            throw e;
         }
         retries++;
         bootstrap.connect(addr).addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) throws Exception {
               LOG.debug("Connection completed. Success: " + future.isSuccess());
            }
         });
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

            }

            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

Examples of org.jboss.netty.channel.ChannelFutureListener

               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

Examples of org.jboss.netty.channel.ChannelFutureListener

            }
           
            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

Examples of org.jboss.netty.channel.ChannelFutureListener

           
            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

Examples of org.jboss.netty.channel.ChannelFutureListener

            LOG.warn("No more message");
            // wait for all outstanding msgs and then close the channel
            // if (outstandingTransactions.intValue() == 0) {
            if (outstandingTransactions == 0) {
               LOG.warn("Close channel");
               channel.close().addListener(new ChannelFutureListener() {
                  public void operationComplete(ChannelFuture future) {
                     answer.offer(true);
                  }
               });
            }
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

         try {
            FullAbortRequest far = new FullAbortRequest();
            far.startTimestamp = transactionId;

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

Examples of org.jboss.netty.channel.ChannelFutureListener

            return deltaSO;
        }

        private void addFinishedWriteListener(ChannelFuture future, final ReadersAwareBuffer buffer) {
            future.addListener(new ChannelFutureListener() {
                @Override
                public void operationComplete(ChannelFuture future) throws Exception {
                    buffer.decreaseReaders();
                    if (buffer.isReadyForPool()) {
                        bufferPool.add(buffer);
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

            if (consumer.getConfiguration().isTextline()) {
                body = NettyHelper.getTextlineBody(body, exchange, consumer.getConfiguration().getDelimiter(), consumer.getConfiguration().isAutoAppendDelimiter());
            }

            // we got a body to write
            ChannelFutureListener listener = createResponseFutureListener(consumer, exchange, messageEvent.getRemoteAddress());
            if (consumer.getConfiguration().isTcp()) {
                NettyHelper.writeBodyAsync(LOG, messageEvent.getChannel(), null, body, exchange, listener);
            } else {
                NettyHelper.writeBodyAsync(LOG, messageEvent.getChannel(), messageEvent.getRemoteAddress(), body, exchange, listener);
            }
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.