Package org.jboss.netty.channel

Examples of org.jboss.netty.channel.ChannelFuture


    private void flushRequest(Channel channel, final MessageBatch requests) {
        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()) {
                    LOG.info(
                            "failed to send requests to " + remote_addr.toString() + ": ", future.getCause());

                    Channel channel = future.getChannel();

                    if (null != channel) {
                        channel.close();
                        channelRef.compareAndSet(channel, null);
                    }
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

            synchronized(createCallbacks) {
               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

               isCommittedCallbacks.put(startTimestamp, callbacks);
            }
           
            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

      public void execute(Channel channel) {
         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

        // mark past buffer as scheduled for pool when all pending operations finish
        pastBuffer.scheduleForPool();

        for (final ReadingBuffer rb : readingBuffers) {
            if (rb.readingBuffer == pastBuffer) {
                ChannelFuture future = Channels.future(rb.channel);
                ChannelBuffer cb = rb.flush(future);
                Channels.write(rb.ctx, future, cb);
            }
        }
View Full Code Here

           for (AbortedTransaction halfAborted : sharedState.hashmap.halfAborted) {
              channel.write(new AbortedTransactionReport(halfAborted.getStartTimestamp()));
           }
        }
        ChannelBuffer cb;
        ChannelFuture future = Channels.future(channel);
        synchronized (sharedMsgBufLock) {
            cb = buffer.flush(future);
        }
        Channels.write(ctx, future, cb);
        Channels.write(channel, new TimestampResponse(timestamp));
View Full Code Here

        bootstrap.setOption("tcpNoDelay", true);

        // Configure the pipeline factory.
        bootstrap.setPipelineFactory(new PipelineFactory());
        ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port));

        // Wait until the connection attempt succeeds or fails.
        channel = future.awaitUninterruptibly().getChannel();
        if (!future.isSuccess())
        {
            bootstrap.releaseExternalResources();
            throw new IOException("Connection Error", future.getCause());
        }
    }
View Full Code Here

            datagramChannelFactory = new NioDatagramChannelFactory(workerPool);
        }
    }

    protected ChannelFuture openConnection() throws Exception {
        ChannelFuture answer;

        if (isTcp()) {
            // its okay to create a new bootstrap for each new channel
            ClientBootstrap clientBootstrap = new ClientBootstrap(channelFactory);
            clientBootstrap.setOption("keepAlive", configuration.isKeepAlive());
View Full Code Here

TOP

Related Classes of org.jboss.netty.channel.ChannelFuture

Copyright © 2018 www.massapicom. 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.