Examples of configureBlocking()


Examples of java.nio.channels.SelectableChannel.configureBlocking()

        if (descriptor.getChannel() instanceof SelectableChannel) {
            SelectableChannel selectableChannel = (SelectableChannel)descriptor.getChannel();
            synchronized (selectableChannel.blockingLock()) {
                boolean oldBlocking = selectableChannel.isBlocking();
                try {
                    selectableChannel.configureBlocking(false);
                    return readpartial(number);
                } finally {
                    selectableChannel.configureBlocking(oldBlocking);
                }
            }
View Full Code Here

Examples of java.nio.channels.SelectableChannel.configureBlocking()

                boolean oldBlocking = selectableChannel.isBlocking();
                try {
                    selectableChannel.configureBlocking(false);
                    return readpartial(number);
                } finally {
                    selectableChannel.configureBlocking(oldBlocking);
                }
            }
        } else if (descriptor.getChannel() instanceof FileChannel) {
            return fread(number);
        } else {
View Full Code Here

Examples of java.nio.channels.SelectableChannel.configureBlocking()

                   RubyIO originalIO = (RubyIO) TypeConverter.convertToType(
                           (IRubyObject) key.attachment(), runtime.getIO(),
                           MethodIndex.TO_IO, "to_io");
                   boolean blocking = originalIO.getBlocking();
                   key.cancel();
                   channel.configureBlocking(blocking);
               }
           }
           selector.close();
          
           if (r.size() == 0 && w.size() == 0 && e.size() == 0) {
View Full Code Here

Examples of java.nio.channels.SelectableChannel.configureBlocking()

    }

    @Override
    protected void init(NioSession session) throws Exception {
        SelectableChannel ch = (SelectableChannel) session.getChannel();
        ch.configureBlocking(false);
        session.setSelectionKey(ch.register(selector, SelectionKey.OP_READ,
                session));
    }

    @Override
View Full Code Here

Examples of java.nio.channels.ServerSocketChannel.configureBlocking()

                continue;
            }

            // 2. Create a ServerSocketChannel
            sock_channel=ServerSocketChannel.open();
            sock_channel.configureBlocking(false);
            sock_channel.socket().bind(key);

            // 3. Register the selector with all server sockets. 'Key' is attachment, so we get it again on
            //    select(). That way we can associate it with the mappings hashmap to find the corresponding
            //    value
View Full Code Here

Examples of java.nio.channels.ServerSocketChannel.configureBlocking()

        {
          ServerSocketChannel channel = ServerSocketChannel.open();
         
          try
          {
            channel.configureBlocking(false);
            channel.socket().bind(new InetSocketAddress(anyLocalAddressIPv6, 0));
            Logger.log(new LogEvent(LOGID, "NetworkAdmin: testing nio + ipv6 bind successful"));

            supportsIPv6withNIO = true;
          } catch (Exception e)
View Full Code Here

Examples of java.nio.channels.ServerSocketChannel.configureBlocking()

    private ServerSocket serverSocket;
   
    public NioSocketServer(boolean useNIO) throws IOException {
        if (useNIO) {
            ServerSocketChannel ssc = ServerSocketChannel.open();
            ssc.configureBlocking(false);
            ServerSocket ss = ssc.socket();
            ss.bind(new InetSocketAddress(LISTEN_PORT));
           
            this.selector = Selector.open();
            ssc.register(this.selector, SelectionKey.OP_ACCEPT);
View Full Code Here

Examples of java.nio.channels.ServerSocketChannel.configureBlocking()

        ServerSocketChannel channel = null;

        try
        {
            channel = ServerSocketChannel.open();
            channel.configureBlocking( false );
            channel.socket().setReuseAddress( true );
            InetSocketAddress address = new InetSocketAddress( _serverInfo.getInterface(), _serverInfo.getPort() );
            channel.socket().bind( address, 1024 );
            this._serverInfo.setHost( address.getHostName() + ':' + address.getPort() );
            // this._connectionHeader.setChannel(channel);
View Full Code Here

Examples of java.nio.channels.ServerSocketChannel.configureBlocking()

        try
        {
            ServerSocketChannel ssc = ServerSocketChannel.open();
           
            // Set it to non-blocking, so we can use select
            ssc.configureBlocking( false );
           
            // Get the Socket connected to this channel, and bind it
            // to the listening port
            ServerSocket ss = ssc.socket();
            InetSocketAddress isa = new InetSocketAddress( port );
View Full Code Here

Examples of java.nio.channels.ServerSocketChannel.configureBlocking()

        // create a new Selector for use below
        selector = Selector.open();
        // set the port the server channel will listen to
        serverSocket.bind (new InetSocketAddress (bind,tcpListenPort));
        // set non-blocking mode for the listening socket
        serverChannel.configureBlocking (false);
        // register the ServerSocketChannel with the Selector
        serverChannel.register (selector, SelectionKey.OP_ACCEPT);
        while (doListen) {
            // this may block for a long time, upon return the
            // selected set contains keys of the ready channels
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.