Examples of FutureListener


Examples of io.netty.util.concurrent.FutureListener

                removeListener(channel, listener);
            }
        }

        Future future = conn.unsubscribe(channel);
        future.addListener(new FutureListener() {
            @Override
            public void operationComplete(Future future) throws Exception {
                subscribedChannelsAmount.release();
            }
        });
View Full Code Here

Examples of io.netty.util.concurrent.FutureListener

        if (entry == null) {
            return group.next().newSucceededFuture(null);
        }

        Future future = entry.unsubscribe(channelName);
        future.addListener(new FutureListener() {
            @Override
            public void operationComplete(Future future) throws Exception {
                synchronized (entry) {
                    if (entry.tryClose()) {
                        returnSubscribeConnection(-1, entry);
View Full Code Here

Examples of io.netty.util.concurrent.FutureListener

  @PreDestroy
  void stop() {
    Future<?> listenersFuture = this.listeners.shutdownGracefully();
    Future<?> workersFuture = this.workers.shutdownGracefully();

    listenersFuture.addListener(new FutureListener() {
      @Override
      public void operationComplete(Future future) throws Exception {
        if (future.isSuccess()) {
          log.info("Listeners are shut down");
        } else {
          log.catching(future.cause());
        }
      }
    });

    workersFuture.addListener(new FutureListener() {
      @Override
      public void operationComplete(Future future) throws Exception {
        if (future.isSuccess()) {
          log.info("Workers are shut down");
        } else {
View Full Code Here

Examples of net.sf.cindy.FutureListener

public class DaytimeHandler extends SessionHandlerAdapter {

    public void sessionStarted(Session session) throws Exception {
        ByteBuffer buffer = Charset.UTF8.encode(new Date().toString());
        Future future = session.flush(new DefaultPacket(buffer));
        future.addListener(new FutureListener() {

            public void futureCompleted(Future future) throws Exception {
                future.getSession().close();
            }
        });
View Full Code Here

Examples of net.sf.cindy.FutureListener

        Future future = session.send(response); // send http header
        if (content != null)
            future = session.flush(new DefaultPacket(content)); // send content
        if (!keepAlive)
            future.addListener(new FutureListener() {

                public void futureCompleted(Future future) throws Exception {
                    future.getSession().close();
                }
            });
View Full Code Here

Examples of net.sf.cindy.FutureListener

        response.setParam("Connection", keepAlive ? "keep-alive" : "close");
        response.setContent(header);

        Future future = session.send(response);
        if (!keepAlive)
            future.addListener(new FutureListener() {

                public void futureCompleted(Future future) throws Exception {
                    future.getSession().close();
                }
            });
View Full Code Here

Examples of net.sf.cindy.FutureListener

                int readCount = buffer.read(fc);

                if (readCount == -1) { // end of file
                    buffer.release();
                    session.send(BufferFactory.allocate(0)).addListener(
                            new FutureListener() {

                                public void futureCompleted(Future future)
                                        throws Exception {
                                    future.getSession().close();
                                }
View Full Code Here

Examples of net.sf.cindy.FutureListener

        session.send(new Integer(Integer.MAX_VALUE));
        session.send(new Double(Math.random()));
        session.send(new User("User 1", 20));

        // send object and close the session
        session.send("bye!").addListener(new FutureListener() {

            public void futureCompleted(Future future) throws Exception {
                future.getSession().close();
            }
        });
View Full Code Here

Examples of net.sf.cindy.FutureListener

        send(session);
    }

    private void send(Session session) {
        session.flush(new DefaultPacket(DATA)).addListener(
                new FutureListener() {

                    public void futureCompleted(Future future) throws Exception {
                        if (future.isSucceeded())
                            send(future.getSession());
                    }
View Full Code Here

Examples of org.jgroups.util.FutureListener

   
    for (int i = 0; i < 5; i++){
      Util.sleep(100);
      System.out.println("Invoke all members 'getUser' method");
      NotifyingFuture<RspList> future = disp.callRemoteMethodWithFuture(channel.getAddress(), method_call, new RequestOptions(ResponseMode.GET_ALL, 5000));
      future.setListener(new FutureListener(){

        public void futureDone(Future future) {
          try {
            System.out.println("result is " + future.get());
          } catch (InterruptedException e) {
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.