Examples of readyOps()


Examples of java.nio.channels.SelectionKey.readyOps()

            }

            SelectableChannel[] channels = handler.getChannels();
            for (int i = 0; i < channels.length; i++) {
                SelectionKey key = channels[i].keyFor(selector);
                if ((key.interestOps() & key.readyOps()) != 0) {
                    continue Loop;
                }
            }

            // no event happen
View Full Code Here

Examples of java.nio.channels.SelectionKey.readyOps()

    private void processSelectedKeys() {
        for (Iterator iter = selector.selectedKeys().iterator(); iter.hasNext();) {
            SelectionKey key = (SelectionKey) iter.next();
            iter.remove();

            key.interestOps(key.interestOps() & ~key.readyOps());
            Attachment attachment = (Attachment) key.attachment();
            ReactorHandler handler = attachment.handler;

            if (key.isWritable()) // do not check session timeout when writing
                attachment.writing = true;
View Full Code Here

Examples of java.nio.channels.SelectionKey.readyOps()

        if (key.isValid()) {
          NetSelectionCallback cb =
            (NetSelectionCallback) key.attachment();

          sel_keys_valid += 1;
          if (key.readyOps() != 0) {
            sel_keys_ready += 1;
          }

          cb.handleEvent(key);
        }
View Full Code Here

Examples of java.nio.channels.SelectionKey.readyOps()

        if (selector != null) {
            for (Iterator i = selector.selectedKeys().iterator(); i.hasNext();) {
                SelectionKey key = (SelectionKey) i.next();
                int ioIndex = (Integer) key.attachment();
                try {
                    int interestAndReady = key.interestOps() & key.readyOps();
                    if (readArray != null && (interestAndReady & (SelectionKey.OP_READ | SelectionKey.OP_ACCEPT | SelectionKey.OP_CONNECT)) != 0) {
                        getReadResults().append(readArray.eltOk(ioIndex));
                        if (pendingReads != null) {
                            pendingReads[ioIndex] = false;
                        }
View Full Code Here

Examples of java.nio.channels.SelectionKey.readyOps()

                        SelectionKey sk = iterator.next();
                        KeyAttachment attachment = (KeyAttachment)sk.attachment();
                        try {
                            attachment.access();
                            iterator.remove();
                            sk.interestOps(sk.interestOps() & (~sk.readyOps()));
                            if ( sk.isReadable() ) {
                                countDown(attachment.getReadLatch());
                            }
                            if (sk.isWritable()) {
                                countDown(attachment.getWriteLatch());
View Full Code Here

Examples of java.nio.channels.SelectionKey.readyOps()

      try {
        clientSel.select();
        for (Iterator i = clientSel.selectedKeys().iterator(); i.hasNext();) {
          SelectionKey sk = (SelectionKey)i.next();
          i.remove();
          if ((sk.readyOps() & SelectionKey.OP_ACCEPT) != 0) {
            ServerSocketChannel nextReady = (ServerSocketChannel)sk.channel();
            SocketChannel sc = nextReady.accept();
            log.finer("Registered new client socket: "+sc);
            handler.handleSocketAccept(sc);
          }
View Full Code Here

Examples of java.nio.channels.SelectionKey.readyOps()

            ServerSocketChannel nextReady = (ServerSocketChannel)sk.channel();
            SocketChannel sc = nextReady.accept();
            log.finer("Registered new client socket: "+sc);
            handler.handleSocketAccept(sc);
          }
          if ((sk.readyOps() & SelectionKey.OP_CONNECT) != 0) {
            // Not implemented yet
          }
          if ((sk.readyOps() & SelectionKey.OP_READ) != 0) {
            IOInterface s = (IOInterface)sk.attachment();
            sk.cancel();
View Full Code Here

Examples of java.nio.channels.SelectionKey.readyOps()

            handler.handleSocketAccept(sc);
          }
          if ((sk.readyOps() & SelectionKey.OP_CONNECT) != 0) {
            // Not implemented yet
          }
          if ((sk.readyOps() & SelectionKey.OP_READ) != 0) {
            IOInterface s = (IOInterface)sk.attachment();
            sk.cancel();
            handler.handleIOInterface(s);
          }
        }
View Full Code Here

Examples of java.nio.channels.SelectionKey.readyOps()

        //        for (SelectionKey sk : selected_keys) {
        for (Iterator i = selector.selectedKeys().iterator(); i.hasNext();) {
          SelectionKey sk = (SelectionKey)i.next();
          i.remove();
          SocketChannel sc = null;
          if ((sk.readyOps() & SelectionKey.OP_ACCEPT) != 0) {
            ServerSocketChannel nextReady = (ServerSocketChannel)sk.channel();
            sc = nextReady.accept();
            log.finest("OP_ACCEPT");
          } // end of if (sk.readyOps() & SelectionKey.OP_ACCEPT)
          if ((sk.readyOps() & SelectionKey.OP_CONNECT) != 0) {
View Full Code Here

Examples of java.nio.channels.SelectionKey.readyOps()

          if ((sk.readyOps() & SelectionKey.OP_ACCEPT) != 0) {
            ServerSocketChannel nextReady = (ServerSocketChannel)sk.channel();
            sc = nextReady.accept();
            log.finest("OP_ACCEPT");
          } // end of if (sk.readyOps() & SelectionKey.OP_ACCEPT)
          if ((sk.readyOps() & SelectionKey.OP_CONNECT) != 0) {
            sk.cancel();
            sc = (SocketChannel)sk.channel();
            log.finest("OP_CONNECT");
          } // end of if (sk.readyOps() & SelectionKey.OP_ACCEPT)
          if (sc != null) {
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.