Package java.nio.channels

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


                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);

                channels.put(req.address, ssc);

                getListeners().fireServiceActivated(this, req.address,
                        req.handler, req.config);
View Full Code Here


            try
            {
                ssc = ServerSocketChannel.open();
                ssc.configureBlocking( false );
                ssc.socket().bind( req.address, req.backlog );
                ssc.register( selector, SelectionKey.OP_ACCEPT, req );

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

        }
        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

            try
            {
                ssc = ServerSocketChannel.open();
                ssc.configureBlocking( false );
                ssc.socket().bind( req.address, req.backlog );
                ssc.register( selector, SelectionKey.OP_ACCEPT, req );

                channels.put( req.address, ssc );
            }
            catch( IOException e )
            {
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

        }
        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

        // set the port the server channel will listen to
        serverSocket.bind (new InetSocketAddress (getBind(),getTcpListenPort()));
        // 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 && selector != null) {
            // this may block for a long time, upon return the
            // selected set contains keys of the ready channels
            try {
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

                } else {
                    return;
                }
            }
            try {
                SelectionKey key = serverChannel.register(this.selector, SelectionKey.OP_ACCEPT);
                key.attach(request);
                request.setKey(key);
            } catch (IOException ex) {
                throw new IOReactorException("Failure registering channel " +
                        "with the selector", ex);
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.