Package org.apache.mina.core.service

Examples of org.apache.mina.core.service.IoAcceptor



    public void stop() {
        for ( Transport transport :getTransports() )
        {
            IoAcceptor acceptor = transport.getAcceptor();
           
            if ( acceptor != null )
            {
                acceptor.dispose();
            }
        }
       
        LOG.info( "DNS service stopped." );
        System.out.println( "DNS service stopped." );
View Full Code Here


        else
        {
            // Kerberos can use UDP or TCP
            for ( Transport transport:transports )
            {
                IoAcceptor acceptor = transport.getAcceptor();
               
                // Now, configure the acceptor
                // Inject the chain
                IoFilterChainBuilder chainBuilder = new DefaultIoFilterChainBuilder();
   
                if ( transport instanceof TcpTransport )
                {
                    // Now, configure the acceptor
                    // Disable the disconnection of the clients on unbind
                    acceptor.setCloseOnDeactivation( false );
                   
                    // No Nagle's algorithm
                    ((NioSocketAcceptor)acceptor).getSessionConfig().setTcpNoDelay( true );
                   
                    // Allow the port to be reused even if the socket is in TIME_WAIT state
                    ((NioSocketAcceptor)acceptor).setReuseAddress( true );

                    // Inject the codec
                    ((DefaultIoFilterChainBuilder)chainBuilder).addFirst( "codec",
                        new ProtocolCodecFilter(
                                KerberosTcpProtocolCodecFactory.getInstance() ) );
                }
                else
                {
                    // Inject the codec
                    ((DefaultIoFilterChainBuilder)chainBuilder).addFirst( "codec",
                        new ProtocolCodecFilter(
                                KerberosUdpProtocolCodecFactory.getInstance() ) );
                }

                acceptor.setFilterChainBuilder( chainBuilder );
               
                // Inject the protocol handler
                acceptor.setHandler( new KerberosProtocolHandler( this, store ) );
               
                // Bind to the configured address
                acceptor.bind();
            }
        }
       
        LOG.info( "Kerberos service started." );
        System.out.println( "Kerberos service started." );
View Full Code Here

   
    public void stop()
    {
        for ( Transport transport :getTransports() )
        {
            IoAcceptor acceptor = transport.getAcceptor();
           
            if ( acceptor != null )
            {
                acceptor.dispose();
            }
        }
       
        LOG.info( "Kerberos service stopped." );
        System.out.println( "Kerberos service stopped." );
View Full Code Here

        }
        else
        {
            for ( Transport transport:transports )
            {
                IoAcceptor acceptor = transport.getAcceptor();

                // Disable the disconnection of the clients on unbind
                acceptor.setCloseOnDeactivation( false );
               
                if ( transport instanceof UdpTransport )
                {
                    // Allow the port to be reused even if the socket is in TIME_WAIT state
                    ((DatagramSessionConfig)acceptor.getSessionConfig()).setReuseAddress( true );
                }
                else
                {
                    // Allow the port to be reused even if the socket is in TIME_WAIT state
                    ((SocketAcceptor)acceptor).setReuseAddress( true );
                   
                    // No Nagle's algorithm
                    ((SocketAcceptor)acceptor).getSessionConfig().setTcpNoDelay( true );
                }
               
                // Set the handler
                acceptor.setHandler( new ChangePasswordProtocolHandler( this, store ) );
               
                // Bind
                acceptor.bind();
            }
        }
       
        LOG.info( "ChangePassword service started." );
        System.out.println( "ChangePassword service started." );
View Full Code Here

    public void stop()
    {
        for ( Transport transport :getTransports() )
        {
            IoAcceptor acceptor = transport.getAcceptor();
           
            if ( acceptor != null )
            {
                acceptor.dispose();
            }
        }

        LOG.info( "ChangePassword service stopped." );
        System.out.println( "ChangePassword service stopped." );
View Full Code Here

        // -------------------------------------------------------------------
        // handle the body of this operation below here
        // -------------------------------------------------------------------

        IoAcceptor acceptor = ( IoAcceptor ) requestor.getIoSession().getService();
        List<IoSession> sessions = new ArrayList<IoSession>(
                acceptor.getManagedSessions().values() );
        GracefulShutdownRequest gsreq = ( GracefulShutdownRequest ) req;

        // build the graceful disconnect message with replicationContexts
        GracefulDisconnect notice = getGracefulDisconnect( gsreq.getTimeOffline(), gsreq.getDelay() );

        // send (synch) the GracefulDisconnect to each client before unbinding
        sendGracefulDisconnect( sessions, notice, requestor.getIoSession() );

        // wait for the specified delay before we unbind the service
        waitForDelay( gsreq.getDelay() );

        // -------------------------------------------------------------------
        // unbind the server socket for the LDAP service here so no new
        // connections are accepted while we process this shutdown request
        // note that the following must be issued before binding the ldap
        // service in order to prevent client disconnects on service unbind:
        //
        // minaRegistry.getAcceptor( service.getTransportType() )
        //                       .setDisconnectClientsOnUnbind( false );
        // -------------------------------------------------------------------
        // This might not work, either.
        acceptor.unbind( requestor.getIoSession().getServiceAddress() );

        // -------------------------------------------------------------------
        // synchronously send a NoD to clients that are not aware of this resp
        // after sending the NoD the client is disconnected if still connected
        // -------------------------------------------------------------------
View Full Code Here

        }
        else
        {
            for ( Transport transport:transports )
            {
                IoAcceptor acceptor = transport.getAcceptor();

                // Set the handler
                acceptor.setHandler( ntpProtocolHandler );
               
                if ( transport instanceof UdpTransport )
                {
                    // Allow the port to be reused even if the socket is in TIME_WAIT state
                    ((DatagramSessionConfig)acceptor.getSessionConfig()).setReuseAddress( true );
                }
                else
                {
                    // Disable the disconnection of the clients on unbind
                    acceptor.setCloseOnDeactivation( false );
                   
                    // Allow the port to be reused even if the socket is in TIME_WAIT state
                    ((SocketAcceptor)acceptor).setReuseAddress( true );
                   
                    // No Nagle's algorithm
                    ((SocketAcceptor)acceptor).getSessionConfig().setTcpNoDelay( true );
                }
               
                // Inject the chain
                acceptor.setFilterChainBuilder( ntpChain );
   
                // Start the listener
                acceptor.bind();
            }
        }
       
        LOG.info( "NTP server started." );
        System.out.println( "NTP server started." );
View Full Code Here

     */
    public void stop()
    {
        for ( Transport transport :getTransports() )
        {
            IoAcceptor acceptor = transport.getAcceptor();
           
            if ( acceptor != null )
            {
                acceptor.dispose();
            }
        }

        LOG.info( "NTP Server stopped." );
        System.out.println( "NTP Server stopped." );
View Full Code Here

        }
        else
        {
            for ( Transport transport : transports )
            {
                IoAcceptor acceptor = transport.getAcceptor();

                // Set the handler
                acceptor.setHandler( ntpProtocolHandler );

                if ( transport instanceof UdpTransport )
                {
                    // Allow the port to be reused even if the socket is in TIME_WAIT state
                    ( ( DatagramSessionConfig ) acceptor.getSessionConfig() ).setReuseAddress( true );
                }
                else
                {
                    // Disable the disconnection of the clients on unbind
                    acceptor.setCloseOnDeactivation( false );

                    // Allow the port to be reused even if the socket is in TIME_WAIT state
                    ( ( SocketAcceptor ) acceptor ).setReuseAddress( true );

                    // No Nagle's algorithm
                    ( ( SocketAcceptor ) acceptor ).getSessionConfig().setTcpNoDelay( true );
                }

                // Inject the chain
                acceptor.setFilterChainBuilder( ntpChain );

                // Start the listener
                acceptor.bind();
            }
        }

        LOG.info( "NTP server started." );
    }
View Full Code Here

     */
    public void stop()
    {
        for ( Transport transport : getTransports() )
        {
            IoAcceptor acceptor = transport.getAcceptor();

            if ( acceptor != null )
            {
                acceptor.dispose();
            }
        }

        LOG.info( "NTP Server stopped." );
    }
View Full Code Here

TOP

Related Classes of org.apache.mina.core.service.IoAcceptor

Copyright © 2018 www.massapicom. 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.