public synchronized static ExecutionHandler getExecutionHandler() { if(null == EXECUTION_HANDLER){ EXECUTION_HANDLER = new ExecutionHandler( new OrderedMemoryAwareThreadPoolExecutor(16, 1048576, 1048576)); } return EXECUTION_HANDLER; }
public HttpServerPipelineFactory(final RequestDispatcher dispatcher, final String root, final int executorThreadCount, final int maxRequestSize, final boolean isKeepAlive, final List<ChannelHandler> additionalChannelHandlers) { this.resteasyDecoder = new RestEasyHttpRequestDecoder(dispatcher.getDispatcher(), root, getProtocol(), isKeepAlive); this.resteasyEncoder = new RestEasyHttpResponseEncoder(dispatcher); this.resteasyRequestHandler = new RequestHandler(dispatcher); if (executorThreadCount > 0) { this.executionHandler = new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(executorThreadCount, 0L, 0L)); } else { this.executionHandler = null; } this.maxRequestSize = maxRequestSize; this.additionalChannelHandlers = additionalChannelHandlers; }
public TextProtocolPipelineFactory() { this.eventExecutor = new OrderedMemoryAwareThreadPoolExecutor(5, 1000000, 10000000, 100, TimeUnit.MILLISECONDS); }
protected ExecutionHandler createExecutionHandler(int size) { return new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(size, 0, 0)); }
protected ExecutionHandler createExecutionHandler(int size) { return new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(size, 0, 0)); }
public HttpServerPipelineFactory(RequestDispatcher dispatcher, String root, int executorThreadCount, int maxRequestSize, boolean isKeepAlive, List<ChannelHandler> additionalChannelHandlers) { this.resteasyDecoder = new RestEasyHttpRequestDecoder(dispatcher.getDispatcher(), root, getProtocol(), isKeepAlive); this.resteasyEncoder = new RestEasyHttpResponseEncoder(dispatcher); this.resteasyRequestHandler = new RequestHandler(dispatcher); if (executorThreadCount > 0) { this.executionHandler = new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(executorThreadCount, 0L, 0L)); } else { this.executionHandler = null; } this.maxRequestSize = maxRequestSize; this.additionalChannelHandlers = additionalChannelHandlers; }
this.executor = new OrderedMemoryAwareThreadPoolExecutor(asyncConfig.getWorkerThreads(), 0, 0, 30, TimeUnit.SECONDS, workerThreadFactory);
new OrderedMemoryAwareThreadPoolExecutor( configuration.getRestThreadPoolSize(), 1048576,
protected OrderedMemoryAwareThreadPoolExecutor createExecutorService() { // use ordered thread pool, to ensure we process the events in order, and can send back // replies in the expected order. eg this is required by TCP. // and use a Camel thread factory so we have consistent thread namings // we should use a shared thread pool as recommended by Netty // NOTE: if we don't specify the MaxChannelMemorySize and MaxTotalMemorySize, the thread pool // could eat up all the heap memory when the tasks are added very fast String pattern = getCamelContext().getExecutorServiceManager().getThreadNamePattern(); ThreadFactory factory = new CamelThreadFactory(pattern, "NettyOrderedWorker", true); return new OrderedMemoryAwareThreadPoolExecutor(getMaximumPoolSize(), configuration.getMaxChannelMemorySize(), configuration.getMaxTotalMemorySize(), 30, TimeUnit.SECONDS, factory); }
@Override protected void startUp() throws Exception { executionHandler = new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(4, 0, 0)); bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool())); bootstrap.setPipelineFactory(new ChannelPipelineFactory() { @Override public ChannelPipeline getPipeline() throws Exception { final ChannelPipeline pipeline = Channels.pipeline(); //pipeline.addLast("logger", new LoggingHandler(InternalLogLevel.INFO)); pipeline.addLast("xmlFramer", new XMLFrameDecoder()); pipeline.addLast("xmlDecoder", new XMLElementDecoder()); pipeline.addLast("xmppDecoder", new XEP0114Decoder(xmppHost, xmppSecret)); pipeline.addLast("executor", executionHandler); pipeline.addLast("xmppHandler", new XMPPStreamHandler(component)); return pipeline; } }); final ChannelFuture future = bootstrap.connect(serverAddress).await(); if (!future.isSuccess()) { bootstrap.releaseExternalResources(); executionHandler.releaseExternalResources(); future.rethrowIfFailed(); } channel = future.getChannel(); component.init(channel, JID.jid("localhost"), JID.jid(xmppHost)); // FIXME }
public OpenVirteXController(CmdLineSettings settings) { this.ofHost = settings.getOFHost(); this.ofPort = settings.getOFPort(); this.dbHost = settings.getDBHost(); this.dbPort = settings.getDBPort(); this.dbClear = settings.getDBClear(); this.maxVirtual = settings.getNumberOfVirtualNets(); this.statsRefresh = settings.getStatsRefresh(); this.nClientThreads = settings.getClientThreads(); this.nServerThreads = settings.getServerThreads(); this.useBDDP = settings.getUseBDDP(); // by default, use Mac addresses to store vLinks informations this.ovxLinkField = OVXLinkField.MAC_ADDRESS; this.clientThreads = new OrderedMemoryAwareThreadPoolExecutor( nClientThreads, 1048576, 1048576, 5, TimeUnit.SECONDS); this.serverThreads = new OrderedMemoryAwareThreadPoolExecutor( nServerThreads, 1048576, 1048576, 5, TimeUnit.SECONDS); this.pfact = new SwitchChannelPipeline(this, this.serverThreads); OpenVirteXController.instance = this; OpenVirteXController.tenantIdCounter = new BitSetIndex( IndexType.TENANT_ID); }
new OrderedMemoryAwareThreadPoolExecutor( coreThreadCnt, maxMemory, maxMemory); final ExecutionHandler executionHandler = new ExecutionHandler(executor); new OrderedMemoryAwareThreadPoolExecutor( coreThreadCnt, maxMemory, maxMemory); final ExecutionHandler executionHandler2 = new ExecutionHandler(executor2);