Package org.apache.mina.io.filter

Examples of org.apache.mina.io.filter.IoThreadPoolFilter


        }

        // Create I/O and Protocol thread pool filter.
        // I/O thread pool performs encoding and decoding of messages.
        // Protocol thread pool performs actual protocol flow.
        IoThreadPoolFilter ioThreadPoolFilter = new IoThreadPoolFilter();
        ProtocolThreadPoolFilter protocolThreadPoolFilter = new ProtocolThreadPoolFilter();

        // and start both.
        ioThreadPoolFilter.start();
        protocolThreadPoolFilter.start();

        IoProtocolConnector connector = new IoProtocolConnector(
                new SocketConnector() );
        connector.getIoConnector().getFilterChain().addFirst( "threadPool",
                ioThreadPoolFilter );
        connector.getFilterChain().addFirst( "threadPool",
                protocolThreadPoolFilter );

        ProtocolProvider protocolProvider = new ClientProtocolProvider( values );
        ProtocolSession session;
        for( ;; )
        {
            try
            {
                session = connector.connect( new InetSocketAddress( HOSTNAME,
                        PORT ), CONNECT_TIMEOUT, protocolProvider );
                break;
            }
            catch( IOException e )
            {
                System.err.println( "Failed to connect." );
                e.printStackTrace();
                Thread.sleep( 5000 );
            }
        }

        // wait until the summation is done
        while( session.isConnected() )
        {
            Thread.sleep( 100 );
        }

        ioThreadPoolFilter.stop();
        protocolThreadPoolFilter.stop();
    }
View Full Code Here


     *
     * @param acceptor The acceptor
     */
    private void configureFilters(SocketAcceptor acceptor) {
        LOG.info("Configuring " + ioWorkerCount + " IO workers");
        IoThreadPoolFilter threadPoolFilter = (IoThreadPoolFilter) acceptor.getFilterChain().getChild("threadPool");
        threadPoolFilter.setMaximumPoolSize(ioWorkerCount);
        if (isLoggingTraffic) {
            LOG.info("Configuring traffic logging filter");
            IoFilter filter = new IoLoggingFilter();
            acceptor.getFilterChain().addLast("LoggingFilter", filter);
        }
View Full Code Here

        }

        // Create I/O and Protocol thread pool filter.
        // I/O thread pool performs encoding and decoding of messages.
        // Protocol thread pool performs actual protocol flow.
        IoThreadPoolFilter ioThreadPoolFilter = new IoThreadPoolFilter();
        ProtocolThreadPoolFilter protocolThreadPoolFilter = new ProtocolThreadPoolFilter();

        // and start both.
        ioThreadPoolFilter.start();
        protocolThreadPoolFilter.start();

        IoProtocolConnector connector = new IoProtocolConnector(
                new SocketConnector() );
        connector.getIoConnector().getFilterChain().addFirst( "threadPool",
                ioThreadPoolFilter );
        connector.getFilterChain().addFirst( "threadPool",
                protocolThreadPoolFilter );

        ProtocolProvider protocolProvider = new ClientProtocolProvider( values );
        ProtocolSession session;
        for( ;; )
        {
            try
            {
                session = connector.connect( new InetSocketAddress( HOSTNAME,
                        PORT ), CONNECT_TIMEOUT, protocolProvider );
                break;
            }
            catch( IOException e )
            {
                System.err.println( "Failed to connect." );
                e.printStackTrace();
                Thread.sleep( 5000 );
            }
        }

        // wait until the summation is done
        while( session.isConnected() )
        {
            Thread.sleep( 100 );
        }

        ioThreadPoolFilter.stop();
        protocolThreadPoolFilter.stop();
    }
View Full Code Here

        }

        // Create I/O and Protocol thread pool filter.
        // I/O thread pool performs encoding and decoding of messages.
        // Protocol thread pool performs actual protocol flow.
        IoThreadPoolFilter ioThreadPoolFilter = new IoThreadPoolFilter();
        ProtocolThreadPoolFilter protocolThreadPoolFilter = new ProtocolThreadPoolFilter();

        // and start both.
        ioThreadPoolFilter.start();
        protocolThreadPoolFilter.start();

        IoProtocolConnector connector = new IoProtocolConnector(
                new SocketConnector() );
        connector.getIoConnector().getFilterChain().addFirst( "threadPool",
                ioThreadPoolFilter );
        connector.getFilterChain().addFirst( "threadPool",
                protocolThreadPoolFilter );

        ProtocolProvider protocolProvider = new ClientProtocolProvider( values );
        ProtocolSession session;
        for( ;; )
        {
            try
            {
                session = connector.connect( new InetSocketAddress( HOSTNAME,
                        PORT ), CONNECT_TIMEOUT, protocolProvider );
                break;
            }
            catch( IOException e )
            {
                System.err.println( "Failed to connect." );
                e.printStackTrace();
                Thread.sleep( 5000 );
            }
        }

        // wait until the summation is done
        while( session.isConnected() )
        {
            Thread.sleep( 100 );
        }

        ioThreadPoolFilter.stop();
        protocolThreadPoolFilter.stop();
    }
View Full Code Here

        }

        // Create I/O and Protocol thread pool filter.
        // I/O thread pool performs encoding and decoding of messages.
        // Protocol thread pool performs actual protocol flow.
        IoThreadPoolFilter ioThreadPoolFilter = new IoThreadPoolFilter();
        ProtocolThreadPoolFilter protocolThreadPoolFilter = new ProtocolThreadPoolFilter();

        // and start both.
        ioThreadPoolFilter.start();
        protocolThreadPoolFilter.start();

        IoProtocolConnector connector = new IoProtocolConnector(
                new SocketConnector() );
        connector.getIoConnector().getFilterChain().addFirst( "threadPool",
                ioThreadPoolFilter );
        connector.getFilterChain().addFirst( "threadPool",
                protocolThreadPoolFilter );

        ProtocolProvider protocolProvider = new ClientProtocolProvider( values );
        ProtocolSession session;
        for( ;; )
        {
            try
            {
                session = connector.connect( new InetSocketAddress( HOSTNAME,
                        PORT ), CONNECT_TIMEOUT, protocolProvider );
                break;
            }
            catch( IOException e )
            {
                System.err.println( "Failed to connect." );
                e.printStackTrace();
                Thread.sleep( 5000 );
            }
        }

        // wait until the summation is done
        while( session.isConnected() )
        {
            Thread.sleep( 100 );
        }

        ioThreadPoolFilter.stop();
        protocolThreadPoolFilter.stop();
    }
View Full Code Here

        }

        // Create I/O and Protocol thread pool filter.
        // I/O thread pool performs encoding and decoding of messages.
        // Protocol thread pool performs actual protocol flow.
        IoThreadPoolFilter ioThreadPoolFilter = new IoThreadPoolFilter();
        ProtocolThreadPoolFilter protocolThreadPoolFilter = new ProtocolThreadPoolFilter();

        // and start both.
        ioThreadPoolFilter.start();
        protocolThreadPoolFilter.start();

        IoProtocolConnector connector = new IoProtocolConnector(
                new SocketConnector() );
        connector.getIoConnector().getFilterChain().addFirst( "threadPool",
                ioThreadPoolFilter );
        connector.getFilterChain().addFirst( "threadPool",
                protocolThreadPoolFilter );

        ProtocolProvider protocolProvider = new ClientProtocolProvider( values );
        ProtocolSession session;
        for( ;; )
        {
            try
            {
                session = connector.connect( new InetSocketAddress( HOSTNAME,
                        PORT ), CONNECT_TIMEOUT, protocolProvider );
                break;
            }
            catch( IOException e )
            {
                System.err.println( "Failed to connect." );
                e.printStackTrace();
                Thread.sleep( 5000 );
            }
        }

        // wait until the summation is done
        while( session.isConnected() )
        {
            Thread.sleep( 100 );
        }

        ioThreadPoolFilter.stop();
        protocolThreadPoolFilter.stop();
    }
View Full Code Here

        }

        // Create I/O and Protocol thread pool filter.
        // I/O thread pool performs encoding and decoding of messages.
        // Protocol thread pool performs actual protocol flow.
        IoThreadPoolFilter ioThreadPoolFilter = new IoThreadPoolFilter();
        ProtocolThreadPoolFilter protocolThreadPoolFilter = new ProtocolThreadPoolFilter();

        // and start both.
        ioThreadPoolFilter.start();
        protocolThreadPoolFilter.start();

        IoProtocolConnector connector = new IoProtocolConnector(
                new SocketConnector() );
        connector.getIoConnector().getFilterChain().addFirst( "threadPool",
                ioThreadPoolFilter );
        connector.getFilterChain().addFirst( "threadPool",
                protocolThreadPoolFilter );

        ProtocolProvider protocolProvider = new ClientProtocolProvider( values );
        ProtocolSession session;
        for( ;; )
        {
            try
            {
                session = connector.connect( new InetSocketAddress( HOSTNAME,
                        PORT ), CONNECT_TIMEOUT, protocolProvider );
                break;
            }
            catch( IOException e )
            {
                System.err.println( "Failed to connect." );
                e.printStackTrace();
                Thread.sleep( 5000 );
            }
        }

        // wait until the summation is done
        while( session.isConnected() )
        {
            Thread.sleep( 100 );
        }

        ioThreadPoolFilter.stop();
        protocolThreadPoolFilter.stop();
    }
View Full Code Here

        }

        // Create I/O and Protocol thread pool filter.
        // I/O thread pool performs encoding and decoding of messages.
        // Protocol thread pool performs actual protocol flow.
        IoThreadPoolFilter ioThreadPoolFilter = new IoThreadPoolFilter();
        ProtocolThreadPoolFilter protocolThreadPoolFilter = new ProtocolThreadPoolFilter();

        // and start both.
        ioThreadPoolFilter.start();
        protocolThreadPoolFilter.start();

        IoProtocolConnector connector = new IoProtocolConnector(
                new SocketConnector() );
        connector.getIoConnector().getFilterChain().addFirst( "threadPool",
                ioThreadPoolFilter );
        connector.getFilterChain().addFirst( "threadPool",
                protocolThreadPoolFilter );

        ProtocolProvider protocolProvider = new ClientProtocolProvider( values );
        ProtocolSession session;
        for( ;; )
        {
            try
            {
                session = connector.connect( new InetSocketAddress( HOSTNAME,
                        PORT ), CONNECT_TIMEOUT, protocolProvider );
                break;
            }
            catch( IOException e )
            {
                System.err.println( "Failed to connect." );
                e.printStackTrace();
                Thread.sleep( 5000 );
            }
        }

        // wait until the summation is done
        while( session.isConnected() )
        {
            Thread.sleep( 100 );
        }

        ioThreadPoolFilter.stop();
        protocolThreadPoolFilter.stop();
    }
View Full Code Here

TOP

Related Classes of org.apache.mina.io.filter.IoThreadPoolFilter

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.