Examples of ChannelFutureListener


Examples of com.facebook.presto.jdbc.internal.netty.channel.ChannelFutureListener

        if (footer != null) {
            Channels.write(ctx, future, footer);
        }

        if (evt != null) {
            future.addListener(new ChannelFutureListener() {
                public void operationComplete(ChannelFuture future) throws Exception {
                    ctx.sendDownstream(evt);
                }
            });
        }
View Full Code Here

Examples of io.netty.channel.ChannelFutureListener

        if (!isTcp()) {
            remoteAddress = new InetSocketAddress(configuration.getHost(), configuration.getPort());
        }

        // write body
        NettyHelper.writeBodyAsync(LOG, channel, remoteAddress, body, exchange, new ChannelFutureListener() {
            public void operationComplete(ChannelFuture channelFuture) throws Exception {
                LOG.trace("Operation complete {}", channelFuture);
                if (!channelFuture.isSuccess()) {
                    // no success the set the caused exception and signal callback and break
                    exchange.setException(channelFuture.cause());
View Full Code Here

Examples of io.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 io.netty.channel.ChannelFutureListener

            data[i] = (ChannelBuffer) pendingWrites.get(i).getMessage();
        }

        ChannelBuffer composite = ChannelBuffers.wrappedBuffer(data);
        ChannelFuture future = Channels.future(ctx.getChannel());
        future.addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future)
                    throws Exception {
                if (future.isSuccess()) {
                    for (MessageEvent e: pendingWrites) {
View Full Code Here

Examples of io.netty.channel.ChannelFutureListener

            final MessageQueue queueBySession = svc.getBus().getQueueBySession(sessionKey);
            queueBySession.setDeliveryHandler(DirectDeliveryHandler.createFor(new NettyQueueChannel(ctx.getChannel())));

            // open the channel
            activeChannels.put(ctx.getChannel(), session);
            ctx.getChannel().getCloseFuture().addListener(new ChannelFutureListener() {
              @Override
              public void operationComplete(final ChannelFuture channelFuture) throws Exception {
                activeChannels.remove(ctx.getChannel());
                queueBySession.setDeliveryHandlerToDefault();
              }
View Full Code Here

Examples of net.gleamynode.netty.channel.ChannelFutureListener

        unwrap(context, e.getChannel(), ChannelBuffer.EMPTY_BUFFER, 0, 0);
        if (!engine.isInboundDone()) {
            if (sentCloseNotify.compareAndSet(false, true)) {
                engine.closeOutbound();
                ChannelFuture closeNotifyFuture = wrapNonAppData(context, e.getChannel());
                closeNotifyFuture.addListener(new ChannelFutureListener() {
                    public void operationComplete(ChannelFuture closeNotifyFuture) throws Exception {
                        closeFutures.offer(e.getFuture());
                    }
                });
                return;
View Full Code Here

Examples of net.gleamynode.netty.channel.ChannelFutureListener

                NioWorker worker = nextWorker();
                channel.setWorker(worker);
                future.setSuccess();
                worker.register(channel);
            } else {
                future.addListener(new ChannelFutureListener() {
                    public void operationComplete(ChannelFuture future) {
                        if (future.isCancelled()) {
                            channel.close();
                        }
                    }
View Full Code Here

Examples of org.elasticsearch.common.netty.channel.ChannelFutureListener

                    writeBuffer.writeShort(0);
                }
                if (keyLength > 0) {
                    writeBuffer.writeBytes(request.getUriBytes());
                }
                ChannelFutureListener releaseContentListener = null;
                if (dataLength > 0) {
                    if (response instanceof XContentRestResponse) {
                        // if its a builder based response, and it was created with a CachedStreamOutput, we can release it
                        // after we write the response, and no need to do an extra copy because its not thread safe
                        XContentBuilder builder = ((XContentRestResponse) response).builder();
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

    ChannelListener listener = this.listenerFactory.createChannelListener(new ObjectChannelImpl(e.getChannel()));
    this.listeners.put(e.getChannel(), listener);
    maxChannels = Math.max(maxChannels, this.listeners.size());
    SslHandler sslHandler = ctx.getPipeline().get(SslHandler.class);
    if (sslHandler != null) {
          sslHandler.handshake().addListener(new ChannelFutureListener() {
            public void operationComplete(ChannelFuture arg0)
                throws Exception {
              onConnection(e.getChannel());
            }
          });
View Full Code Here

Examples of org.jboss.netty.channel.ChannelFutureListener

    public void messageReceived(
            ChannelHandlerContext ctx, final MessageEvent e) {
        receivedMessages ++;
        if (receivedMessages == count) {
            // Offer the answer after closing the connection.
            e.getChannel().close().addListener(new ChannelFutureListener() {
                public void operationComplete(ChannelFuture future) {
                    boolean offered = answer.offer((BigInteger) e.getMessage());
                    assert offered;
                }
            });
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.