Package java.nio.channels

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


        }
        if(log.isInfoEnabled())
            log.info("JK: ajp13 listening on " + getAddress() + ":" + port );

        selector = Selector.open();
        ssc.register(selector, SelectionKey.OP_ACCEPT);
        // If this is not the base port and we are the 'main' channleSocket and
        // SHM didn't already set the localId - we'll set the instance id
        if( "channelNioSocket".equals( name ) &&
            port != startPort &&
            (wEnv.getLocalId()==0) ) {
View Full Code Here


                ssc.socket().setReceiveBufferSize(
                    ( ( SocketSessionConfig ) cfg.getSessionConfig() ).getReceiveBufferSize() );

                // and bind.
                ssc.socket().bind( req.address, cfg.getBacklog() );
                ssc.register( selector, SelectionKey.OP_ACCEPT, req );

                synchronized( channels )
                {
                    channels.put( req.address, ssc );
                }
View Full Code Here

                ssc.socket().bind(req.address, cfg.getBacklog());
                if (req.address == null || req.address.getPort() == 0) {
                    req.address = (InetSocketAddress) ssc.socket()
                            .getLocalSocketAddress();
                }
                ssc.register(selector, SelectionKey.OP_ACCEPT, req);

                synchronized (channels) {
                    channels.put(req.address, ssc);
                }
View Full Code Here

                            }
                        }
                        else if (o instanceof ServerSocketChannel)
                        {
                            ServerSocketChannel channel = (ServerSocketChannel)o;
                            channel.register(getSelector(),SelectionKey.OP_ACCEPT);
                        }
                        else if (o instanceof ChangeTask)
                        {
                            ((ChangeTask)o).run();
                        }
View Full Code Here

                            // Is this for this selectset
                            if (_nextSet==_setID)
                            {
                                // bind connections to this select set.
                                SelectionKey cKey = channel.register(_selectSet[_nextSet].getSelector(), SelectionKey.OP_READ);
                                SelectChannelEndPoint endpoint=newEndPoint(channel,_selectSet[_nextSet],cKey);
                                cKey.attach(endpoint);
                                if (endpoint != null)
                                    endpoint.dispatch();
                            }
View Full Code Here

    throws IOException {
    ServerSocketChannel ssc = ServerSocketChannel.open();
    ssc.configureBlocking(false);
    ssc.socket().setReuseAddress(true);
    port = verboseBind(ssc, port);
    ssc.register(selector_, SelectionKey.OP_ACCEPT, callback);
    server_channels_.add(ssc);
    if (secure) {
      secure_ports_.add(new Integer(port));
    }
    if (first_port_ == 0) {
View Full Code Here

            ServerSocketChannel serverSocketChannel =
                serverSocket.getChannel();
            if (serverSocketChannel != null) {
                // Register channel with the Selector.
                if (opAccept) {
                    serverSocketChannel.register(selector,
                            SelectionKey.OP_ACCEPT);
                }
                if (opConnect) {
                    serverSocketChannel.register(selector,
                            SelectionKey.OP_CONNECT);
View Full Code Here

                if (opAccept) {
                    serverSocketChannel.register(selector,
                            SelectionKey.OP_ACCEPT);
                }
                if (opConnect) {
                    serverSocketChannel.register(selector,
                            SelectionKey.OP_CONNECT);
                }
                if (opRead) {
                    serverSocketChannel.register(selector,
                            SelectionKey.OP_READ);
View Full Code Here

                if (opConnect) {
                    serverSocketChannel.register(selector,
                            SelectionKey.OP_CONNECT);
                }
                if (opRead) {
                    serverSocketChannel.register(selector,
                            SelectionKey.OP_READ);
                }
                if (opWrite) {
                    serverSocketChannel.register(selector,
                            SelectionKey.OP_WRITE);
View Full Code Here

                if (opRead) {
                    serverSocketChannel.register(selector,
                            SelectionKey.OP_READ);
                }
                if (opWrite) {
                    serverSocketChannel.register(selector,
                            SelectionKey.OP_WRITE);
                }
                return selector;
            } else {
                throw new IllegalActionException(
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.