Examples of ExecutorFilter


Examples of org.apache.mina.filter.executor.ExecutorFilter

        ntpConfig = new NtpServer( );
        port = AvailablePortFinder.getNextAvailable( 10123 );
        TcpTransport tcpTransport = new TcpTransport( port );
        UdpTransport udpTransport = new UdpTransport( port );
        ntpConfig.setTransports( tcpTransport, udpTransport );
        ntpConfig.getDatagramAcceptor( udpTransport ).getFilterChain().addLast( "executor", new ExecutorFilter( Executors.newCachedThreadPool() ) );
        ntpConfig.getSocketAcceptor( tcpTransport ).getFilterChain().addLast( "executor", new ExecutorFilter( Executors.newCachedThreadPool() ) );
        ntpConfig.setEnabled( true );
        ntpConfig.start();

    }
View Full Code Here

Examples of org.apache.mina.filter.executor.ExecutorFilter

           
            // Now inject an ExecutorFilter for the write operations
            // We use the same number of thread than the number of IoProcessor
            // (NOTE : this has to be double checked)
            ((DefaultIoFilterChainBuilder)chain).addLast( "executor",
                    new ExecutorFilter(
                        new UnorderedThreadPoolExecutor( transport.getNbThreads() ),
                        IoEventType.MESSAGE_RECEIVED ) );

            /*
             * The server is now initialized, we can
View Full Code Here

Examples of org.apache.mina.filter.executor.ExecutorFilter

    private ExecutorThreadModel( String threadNamePrefix )
    {
        this.threadNamePrefix = threadNamePrefix;
       
        // Create the default filter
        defaultFilter = new ExecutorFilter();
        ThreadPoolExecutor tpe = ( ThreadPoolExecutor ) defaultFilter.getExecutor();
        final ThreadFactory originalThreadFactory = tpe.getThreadFactory();
        ThreadFactory newThreadFactory = new ThreadFactory()
        {
            private final AtomicInteger threadId = new AtomicInteger( 0 );
View Full Code Here

Examples of org.apache.mina.filter.executor.ExecutorFilter

        {
            filter = defaultFilter;
        }
        else
        {
            filter = new ExecutorFilter( executor );
        }
    }
View Full Code Here

Examples of org.apache.mina.filter.executor.ExecutorFilter

    public synchronized void initialize() {
        if (this.acceptor == null) {
            NioSocketAcceptor acceptor = session.getServerFactoryManager().getTcpipForwardingAcceptorFactory().createNioSocketAcceptor(session);
            acceptor.setHandler(this);
            acceptor.setReuseAddress(true);
            acceptor.getFilterChain().addLast("executor", new ExecutorFilter(EnumSet.complementOf(EnumSet.of(IoEventType.SESSION_CREATED)).toArray(new IoEventType[0])));
            this.acceptor = acceptor;
        }
    }
View Full Code Here

Examples of org.apache.mina.filter.executor.ExecutorFilter

        if (_protectIO)
        {
            //Add IO Protection Filters
            IoFilterChain chain = protocolSession.getFilterChain();

            protocolSession.getFilterChain().addLast("tempExecutorFilterForFilterBuilder", new ExecutorFilter());

            ReadThrottleFilterBuilder readfilter = new ReadThrottleFilterBuilder();
            readfilter.setMaximumConnectionBufferSize(_config.getReceiveBufferSize());
            readfilter.attach(chain);
View Full Code Here

Examples of org.apache.mina.filter.executor.ExecutorFilter

            // add and update the blacklist filter
            acceptor.getFilterChain().addLast("ipFilter", new BlacklistFilter());
            updateBlacklistFilter();
   
            acceptor.getFilterChain().addLast("threadPool",
                    new ExecutorFilter(filterExecutor));
            acceptor.getFilterChain().addLast("codec",
                    new ProtocolCodecFilter(new FtpServerProtocolCodecFactory()));
            acceptor.getFilterChain().addLast("mdcFilter2", mdcFilter);
            acceptor.getFilterChain().addLast("logger", new FtpLoggingFilter());
   
View Full Code Here

Examples of org.apache.mina.filter.executor.ExecutorFilter

        SocketConnectorConfig connectorConfig = new SocketConnectorConfig();
        // must use manual thread model according to Mina documentation
        connectorConfig.setThreadModel(ThreadModel.MANUAL);
        configureCodecFactory("MinaProducer", connectorConfig, configuration);
        connectorConfig.getFilterChain().addLast("threadPool",
                new ExecutorFilter(getCamelContext().getExecutorServiceStrategy().newDefaultThreadPool(this, "MinaThreadPool")));
        if (minaLogger) {
            connectorConfig.getFilterChain().addLast("logger", new LoggingFilter());
        }
        appendIoFiltersToChain(filters, connectorConfig.getFilterChain());

        // set connect timeout to mina in seconds
        connectorConfig.setConnectTimeout((int) (timeout / 1000));

        // acceptor connectorConfig
        SocketAcceptorConfig acceptorConfig = new SocketAcceptorConfig();
        // must use manual thread model according to Mina documentation
        acceptorConfig.setThreadModel(ThreadModel.MANUAL);
        configureCodecFactory("MinaConsumer", acceptorConfig, configuration);
        acceptorConfig.setReuseAddress(true);
        acceptorConfig.setDisconnectOnUnbind(true);
        acceptorConfig.getFilterChain().addLast("threadPool",
                new ExecutorFilter(getCamelContext().getExecutorServiceStrategy().newDefaultThreadPool(this, "MinaThreadPool")));
        if (minaLogger) {
            acceptorConfig.getFilterChain().addLast("logger", new LoggingFilter());
        }
        appendIoFiltersToChain(filters, acceptorConfig.getFilterChain());
View Full Code Here

Examples of org.apache.mina.filter.executor.ExecutorFilter

        DatagramConnectorConfig connectorConfig = new DatagramConnectorConfig();
        // must use manual thread model according to Mina documentation
        connectorConfig.setThreadModel(ThreadModel.MANUAL);
        configureDataGramCodecFactory("MinaProducer", connectorConfig, configuration);
        connectorConfig.getFilterChain().addLast("threadPool",
                new ExecutorFilter(getCamelContext().getExecutorServiceStrategy().newDefaultThreadPool(this, "MinaThreadPool")));
        if (minaLogger) {
            connectorConfig.getFilterChain().addLast("logger", new LoggingFilter());
        }
        appendIoFiltersToChain(filters, connectorConfig.getFilterChain());
        // set connect timeout to mina in seconds
        connectorConfig.setConnectTimeout((int) (timeout / 1000));

        DatagramAcceptorConfig acceptorConfig = new DatagramAcceptorConfig();
        // must use manual thread model according to Mina documentation
        acceptorConfig.setThreadModel(ThreadModel.MANUAL);
        configureDataGramCodecFactory("MinaConsumer", acceptorConfig, configuration);
        acceptorConfig.setDisconnectOnUnbind(true);
        // reuse address is default true for datagram
        acceptorConfig.getFilterChain().addLast("threadPool",
                new ExecutorFilter(getCamelContext().getExecutorServiceStrategy().newDefaultThreadPool(this, "MinaThreadPool")));
        if (minaLogger) {
            acceptorConfig.getFilterChain().addLast("logger", new LoggingFilter());
        }
        appendIoFiltersToChain(filters, acceptorConfig.getFilterChain());
View Full Code Here

Examples of org.apache.mina.filter.executor.ExecutorFilter

       
        // add and update the blacklist filter
        acceptor.getFilterChain().addLast("ipFilter", new BlacklistFilter());
        updateBlacklistFilter();
       
        acceptor.getFilterChain().addLast("threadPool", new ExecutorFilter(filterExecutor));
        acceptor.getFilterChain().addLast(
            "codec",
            new ProtocolCodecFilter( new FtpServerProtocolCodecFactory() ) );
        acceptor.getFilterChain().addLast("mdcFilter2", mdcFilter);
        acceptor.getFilterChain().addLast("logger", new FtpLoggingFilter() );
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.