/** {@inheritDoc} */ @Override protected GridConfiguration getConfiguration(String gridName) throws Exception { GridConfiguration c = super.getConfiguration(gridName); c.setLocalHost(HOST); assert c.getClientConnectionConfiguration() == null; GridClientConnectionConfiguration clientCfg = new GridClientConnectionConfiguration(); clientCfg.setRestTcpPort(REST_TCP_PORT_BASE); GridSslContextFactory sslCtxFactory = sslContextFactory(); if (sslCtxFactory != null) { clientCfg.setRestTcpSslEnabled(true); clientCfg.setRestTcpSslContextFactory(sslCtxFactory); } c.setClientConnectionConfiguration(clientCfg); GridTcpDiscoverySpi disco = new GridTcpDiscoverySpi(); disco.setIpFinder(IP_FINDER); c.setDiscoverySpi(disco); TestCommunicationSpi spi = new TestCommunicationSpi(); spi.setLocalPort(GridTestUtils.getNextCommPort(getClass())); c.setCommunicationSpi(spi); c.setCacheConfiguration( cacheConfiguration(null), cacheConfiguration(PARTITIONED_CACHE_NAME), cacheConfiguration(REPLICATED_CACHE_NAME), cacheConfiguration(REPLICATED_ASYNC_CACHE_NAME)); ThreadPoolExecutor exec = new ThreadPoolExecutor(40, 40, 0, MILLISECONDS, new LinkedBlockingQueue<Runnable>()); exec.prestartAllCoreThreads(); c.setExecutorService(exec); c.setExecutorServiceShutdown(true); ThreadPoolExecutor sysExec = new ThreadPoolExecutor(40, 40, 0, MILLISECONDS, new LinkedBlockingQueue<Runnable>()); sysExec.prestartAllCoreThreads(); c.setSystemExecutorService(sysExec); c.setSystemExecutorServiceShutdown(true); return c; }
/** {@inheritDoc} */ @Override protected GridConfiguration getConfiguration(String gridName) throws Exception { GridConfiguration cfg = super.getConfiguration(gridName); if (cache) { GridCacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setCacheMode(PARTITIONED); cacheCfg.setBackups(1); cacheCfg.setDistributionMode(nearOnly ? NEAR_ONLY : NEAR_PARTITIONED); cacheCfg.setPreloadMode(SYNC); cacheCfg.setAtomicityMode(TRANSACTIONAL); cfg.setCacheConfiguration(cacheCfg); } GridTcpDiscoverySpi discoSpi = new GridTcpDiscoverySpi(); discoSpi.setIpFinder(IP_FINDER); cfg.setDiscoverySpi(discoSpi); return cfg; }