Package io.netty.channel

Examples of io.netty.channel.ChannelFuture.cancel()


    public void cancelPendingFutures(boolean mayInterruptIfRunning) {
        for (Iterator<ChannelFuture> iterator = pendingFutures.iterator(); iterator.hasNext(); ) {
            ChannelFuture pendingFuture = iterator.next();
            iterator.remove();
            pendingFuture.cancel(mayInterruptIfRunning);
        }
    }

    @Override
    public void operationComplete(ChannelFuture future) throws Exception {
View Full Code Here


        subscriber.add(Subscriptions.create(new Action0() {
            @Override
            public void call() {
                if (!connectFuture.isDone()) {
                    connectFuture.cancel(true); // Unsubscribe here means, no more connection is required. A close on connection is explicit.
                }
            }
        }));

        connectFuture.addListener(new ChannelFutureListener() {
View Full Code Here

        boolean result = cancelled.compareAndSet(false, true);
        if (result) {
            try {
                ChannelFuture fut = future;
                if (fut != null) {
                    fut.cancel(true);
                }
                if (fut != null && fut.channel() != null && fut.channel().isOpen()) {
                    fut.channel().close();
                }
            } finally {
View Full Code Here

                } else {
                    throw future.cause();
                }
            }

            if (future.cancel(true)) {
                assertThat(future.channel().closeFuture().await(500), is(true));
                assertThat(future.isCancelled(), is(true));
            } else {
                // Cancellation not supported by the transport.
            }
View Full Code Here

        Channel sc = sb.bind().sync().channel();
        Channel cc = cb.connect().sync().channel();

        ChannelFuture f = cc.write(a);
        assertTrue(f.cancel(false));
        cc.writeAndFlush(b);
        cc.write(c);
        ChannelFuture f2 = cc.write(d);
        assertTrue(f2.cancel(false));
        cc.writeAndFlush(e);
View Full Code Here

        ChannelFuture f = cc.write(a);
        assertTrue(f.cancel(false));
        cc.writeAndFlush(b);
        cc.write(c);
        ChannelFuture f2 = cc.write(d);
        assertTrue(f2.cancel(false));
        cc.writeAndFlush(e);

        while (sh.counter < 3) {
            if (sh.exception.get() != null) {
                break;
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.