builder.transport().transportThreadPool().read(this.pools.get(ThreadPoolResourceDefinition.TRANSPORT).get()); builder.transport().remoteCommandThreadPool().read(this.pools.get(ThreadPoolResourceDefinition.REMOTE_COMMAND).get());
public void amendConfiguration(ConfigurationBuilderHolder holder) { TransportConfigurationBuilder transport = holder.getGlobalConfigurationBuilder().transport(); transport.nodeName(TestResourceTracker.getNextNodeName()); transport.clusterName(TestResourceTracker.getCurrentTestName()); // minimize number of threads using unlimited cached thread pool transport.remoteCommandThreadPool().threadPoolFactory(CachedThreadPoolExecutorFactory.create()); transport.transportThreadPool().threadPoolFactory(CachedThreadPoolExecutorFactory.create()); for (Map.Entry<String, ConfigurationBuilder> cfg : holder.getNamedConfigurationBuilders().entrySet()) { amendCacheConfiguration(cfg.getKey(), cfg.getValue()); } // disable simple cache for testing as we need to insert interceptors if (!pendingPutsSimple) { holder.getNamedConfigurationBuilders().get(DEF_PENDING_PUTS_RESOURCE).simpleCache(false); } }
protected EmbeddedCacheManager addClusterEnabledCacheManager(TransportFlags flags) { GlobalConfigurationBuilder gcb = GlobalConfigurationBuilder.defaultClusteredBuilder(); // Amend first so we can increase the transport thread pool TestCacheManagerFactory.amendGlobalConfiguration(gcb, flags); // we need to increase the transport and remote thread pools to default values BlockingThreadPoolExecutorFactory executorFactory = new BlockingThreadPoolExecutorFactory( 25, 25, 10000, 30000); gcb.transport().transportThreadPool().threadPoolFactory(executorFactory); gcb.transport().remoteCommandThreadPool().threadPoolFactory(executorFactory); EmbeddedCacheManager cm = TestCacheManagerFactory.newDefaultCacheManager(true, gcb, new ConfigurationBuilder(), false); cacheManagers.add(cm); return cm; }
protected EmbeddedCacheManager addClusterEnabledCacheManager(TransportFlags flags) { GlobalConfigurationBuilder gcb = GlobalConfigurationBuilder.defaultClusteredBuilder(); // Amend first so we can increase the transport thread pool TestCacheManagerFactory.amendGlobalConfiguration(gcb, flags); // we need to increase the transport and remote thread pools to default values BlockingThreadPoolExecutorFactory executorFactory = new BlockingThreadPoolExecutorFactory( 25, 25, 10000, 30000); gcb.transport().transportThreadPool().threadPoolFactory(executorFactory); gcb.transport().remoteCommandThreadPool().threadPoolFactory(executorFactory); EmbeddedCacheManager cm = TestCacheManagerFactory.newDefaultCacheManager(true, gcb, new ConfigurationBuilder(), false); cacheManagers.add(cm); return cm; }
protected EmbeddedCacheManager addClusterEnabledCacheManager(TransportFlags flags) { GlobalConfigurationBuilder gcb = GlobalConfigurationBuilder.defaultClusteredBuilder(); // Amend first so we can increase the transport thread pool TestCacheManagerFactory.amendGlobalConfiguration(gcb, flags); // we need to increase the transport and remote thread pools to default values BlockingThreadPoolExecutorFactory executorFactory = new BlockingThreadPoolExecutorFactory( 25, 25, 10000, 30000); gcb.transport().transportThreadPool().threadPoolFactory(executorFactory); gcb.transport().remoteCommandThreadPool().threadPoolFactory(executorFactory); EmbeddedCacheManager cm = TestCacheManagerFactory.newDefaultCacheManager(true, gcb, new ConfigurationBuilder(), false); cacheManagers.add(cm); return cm; }
builder.transport().transportThreadPool().read(this.pools.get(ThreadPoolResourceDefinition.TRANSPORT).get()); builder.transport().remoteCommandThreadPool().read(this.pools.get(ThreadPoolResourceDefinition.REMOTE_COMMAND).get());
transportBuilder.transportThreadPool().read(this.transportThreadPool.getValue()); transportBuilder.remoteCommandThreadPool().read(this.remoteCommandThreadPool.getValue());
public static void minimizeThreads(GlobalConfigurationBuilder builder) { BlockingThreadPoolExecutorFactory executorFactoryNoQueue = new BlockingThreadPoolExecutorFactory(NAMED_EXECUTORS_THREADS_NO_QUEUE, 0, 0, NAMED_EXECUTORS_KEEP_ALIVE); BlockingThreadPoolExecutorFactory executorFactoryWithQueue = new BlockingThreadPoolExecutorFactory(NAMED_EXECUTORS_THREADS_WITH_QUEUE, NAMED_EXECUTORS_THREADS_WITH_QUEUE, NAMED_EXECUTORS_QUEUE_SIZE, NAMED_EXECUTORS_KEEP_ALIVE); builder.transport().remoteCommandThreadPool().threadPoolFactory(executorFactoryNoQueue); builder.stateTransferThreadPool().threadPoolFactory(executorFactoryNoQueue); builder.asyncThreadPool().threadPoolFactory(executorFactoryWithQueue); builder.listenerThreadPool().threadPoolFactory(executorFactoryWithQueue); builder.transport().transportThreadPool().threadPoolFactory(executorFactoryWithQueue); // TODO Scheduled thread pools don't have a threads limit // Timeout thread pool is not configurable at all }
BlockingThreadPoolExecutorFactory transportExecutorFactory = new BlockingThreadPoolExecutorFactory( TRANSPORT_MAX_THREADS, TRANSPORT_MAX_THREADS, TRANSPORT_QUEUE_SIZE, 60000); gcb.transport().transportThreadPool().threadPoolFactory(transportExecutorFactory); BlockingThreadPoolExecutorFactory remoteExecutorFactory = new BlockingThreadPoolExecutorFactory( REMOTE_MAX_THREADS, REMOTE_MAX_THREADS, REMOTE_QUEUE_SIZE, 60000);
holder.getGlobalConfigurationBuilder().transport().transportThreadPool().threadFactory(threadFactory).threadPoolFactory(executorFactory); break;
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder(); builder.transport().transportThreadPool().threadPoolFactory(new WithinThreadExecutorFactory()); cacheManager = TestCacheManagerFactory.createClusteredCacheManager(builder, new ConfigurationBuilder()); cacheManager.defineConfiguration(LOCAL_CACHE_NAME, getBaseCfg().build()); cacheManager.defineConfiguration(REPL_SYNC_CACHE_NAME, getClusteredCfg(REPL_SYNC, false).build()); cacheManager.defineConfiguration(REPL_ASYNC_CACHE_NAME, getClusteredCfg(REPL_ASYNC, false).build()); cacheManager.defineConfiguration(DIST_SYNC_CACHE_NAME, getClusteredCfg(DIST_SYNC, false).build()); cacheManager.defineConfiguration(DIST_ASYNC_CACHE_NAME, getClusteredCfg(DIST_ASYNC, false).build()); cacheManager.defineConfiguration(DIST_SYNC_L1_CACHE_NAME, getClusteredCfg(DIST_SYNC, true).build()); cacheManager.defineConfiguration(DIST_ASYNC_L1_CACHE_NAME, getClusteredCfg(DIST_ASYNC, true).build()); return cacheManager; }