Package java.nio.channels

Examples of java.nio.channels.SocketChannel.validOps()


    @Override
    void accept (ServerSocketChannel server, Selector selector) throws IOException {
        SocketChannel channel = server.accept ();
        channel.configureBlocking (false);
       
        int validOps = channel.validOps ();
        System.out.println (validOps);
       
        if (! checkEligibility (channel)) {
            channel.finishConnect ();
            selector.close ();
View Full Code Here


        try {
          s = SocketChannel.open();
          s.configureBlocking(false);
          // now this method is non-blocking
          s.connect(server);
          key = s.register(selector, s.validOps());
          // attach index of the key
          key.attach(i);
        } catch (Exception e) {
          stats.incNumConnectErrorServers()
          String err = String.format("set up socket to server %s error: %s",
View Full Code Here

                    }

                    synchronized(selector) {
                      selector.wakeup();
                      try {
                        newChannel.register(selector, newChannel.validOps());
                      } catch (ClosedChannelException e1) {
                        logger.error("An exception occurred while registering a selector: {}",e1.getMessage());
                      }                   
                    }
View Full Code Here

        try {
          s = SocketChannel.open();
          s.configureBlocking(false);
          // now this method is non-blocking
          s.connect(server);
          key = s.register(selector, s.validOps());
          // attach index of the key
          key.attach(i);
        } catch (Exception e) {
          stats.incNumConnectErrorServers()
          String err = String.format("set up socket to server %s error: %s",
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.