Examples of OrderedMemoryAwareThreadPoolExecutor


Examples of org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor

        pipeline.addLast( "encoder", new StringEncoder() );
        // Note that outbound mode requires the decoder to treat many 'headers' as body lines
        pipeline.addLast( "decoder", new EslFrameDecoder( 8092, true ) );
        // Add an executor to ensure separate thread for each upstream message from here
        pipeline.addLast( "executor", new ExecutionHandler(
            new OrderedMemoryAwareThreadPoolExecutor( 16, 1048576, 1048576 ) ) );

        // now the outbound client logic
        pipeline.addLast( "clientHandler", makeHandler() );
       
        return pipeline;
View Full Code Here

Examples of org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor

        ChannelPipeline pipeline = Channels.pipeline();
        pipeline.addLast( "encoder", new StringEncoder() );
        pipeline.addLast( "decoder", new EslFrameDecoder( 8192 ) );
        // Add an executor to ensure separate thread for each upstream message from here
        pipeline.addLast( "executor", new ExecutionHandler(
            new OrderedMemoryAwareThreadPoolExecutor( 16, 1048576, 1048576 ) ) );

        // now the inbound client logic
        pipeline.addLast( "clientHandler", handler );
       
        return pipeline;
View Full Code Here

Examples of org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor

        this.timer = new HashedWheelTimer(daemonThreadsNamed(namePrefix + "-timer-%s"));

        ChannelFactory channelFactory = new NioClientSocketChannelFactory(ioPool.getBossPool(), ioPool.getWorkerPool());

        ThreadFactory workerThreadFactory = daemonThreadsNamed(namePrefix + "-worker-%s");
        this.executor = new OrderedMemoryAwareThreadPoolExecutor(asyncConfig.getWorkerThreads(), 0, 0, 30, TimeUnit.SECONDS, workerThreadFactory);
        this.executorMBean = new ThreadPoolExecutorMBean(executor);

        ClientBootstrap bootstrap;
        if (config.getSocksProxy() == null) {
            bootstrap = new ClientBootstrap(channelFactory);
View Full Code Here

Examples of org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor

    };

    // Thread pool of max size = MAX_HANDLER_THREADS and will reject new tasks by throwing exceptions
    // The pipeline should have handler to catch the exception and response with status 503.
    ThreadPoolExecutor threadPoolExecutor =
      new OrderedMemoryAwareThreadPoolExecutor(MAX_HANDLER_THREADS, 0, 0, 60L, TimeUnit.SECONDS,
                                               threadFactory);
    threadPoolExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
    return new ExecutionHandler(threadPoolExecutor);
  }
View Full Code Here

Examples of org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor

      }
    };

    //Create ExecutionHandler
    ThreadPoolExecutor threadPoolExecutor =
      new OrderedMemoryAwareThreadPoolExecutor(threadPoolSize, 0, 0,
                                               threadKeepAliveSecs, TimeUnit.SECONDS, threadFactory);
    threadPoolExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
    return new ExecutionHandler(threadPoolExecutor);
  }
View Full Code Here

Examples of org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor

    @Override
    public Executor create() {
        LoggerFactory.getLogger(getClass()).info(
                "Creating an OMATPE with maxmemperchannel= {} and maxmemperexecutor= {}", maxMemoryPerChannel,
                maxMemoryPerExecutor);
        return new OrderedMemoryAwareThreadPoolExecutor(1, maxMemoryPerChannel, maxMemoryPerExecutor, 60,
                TimeUnit.SECONDS, new ThreadFactoryBuilder().setNameFormat("listener-deserializer-%d").build());
    }
View Full Code Here

Examples of org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor

            // replies in the expected order. eg this is required by TCP.
            // and use a Camel thread factory so we have consistent thread namings
            String pattern = consumer.getContext().getExecutorServiceManager().getThreadNamePattern();
            ThreadFactory factory = new CamelThreadFactory(pattern, "NettyOrderedWorker", true);
            final ExecutionHandler executionHandler = new ExecutionHandler(
                    new OrderedMemoryAwareThreadPoolExecutor(consumer.getConfiguration().getMaximumPoolSize(),
                            0L, 0L, 30, TimeUnit.SECONDS, factory));
            // this must be added just before the ServerChannelHandler
            addToPipeline("executionHandler", channelPipeline, executionHandler);
            LOG.debug("Using OrderedMemoryAwareThreadPoolExecutor with core pool size: {}", consumer.getConfiguration().getMaximumPoolSize());
        }
View Full Code Here

Examples of org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor

        bootstrap.getPipeline().addLast("encoder", new Encoder());
        bootstrap.getPipeline().addLast("decoder", new Decoder());
        bootstrap.getPipeline().addLast("handler", new NetworkManager());
        bootstrap.getPipeline().addLast("pipelineExecutor", new ExecutionHandler
                (
                        new OrderedMemoryAwareThreadPoolExecutor(
                                200,
                                1048576,
                                1073741824,
                                100,
                                TimeUnit.MILLISECONDS,
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.