/** * Create Grid configuration with configured checkpoints. * * @return Grid configuration. * @throws GridException If configuration creation failed. */ public static GridConfiguration configuration() throws GridException { GridConfiguration cfg = new GridConfiguration(); cfg.setLocalHost("127.0.0.1"); cfg.setPeerClassLoadingEnabled(true); GridOptimizedMarshaller marsh = new GridOptimizedMarshaller(); marsh.setRequireSerializable(false); cfg.setMarshaller(marsh); cfg.setDeploymentSpi(new GridUriDeploymentSpi()); GridTcpDiscoverySpi discoSpi = new GridTcpDiscoverySpi(); GridTcpDiscoveryVmIpFinder ipFinder = new GridTcpDiscoveryVmIpFinder(); ipFinder.setAddresses(Collections.singletonList("127.0.0.1:47500..47509")); discoSpi.setIpFinder(ipFinder); cfg.setDiscoverySpi(discoSpi); return cfg; }
/** {@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); GridTcpDiscoverySpi discoSpi = new GridTcpDiscoverySpi(); discoSpi.setIpFinder(IP_FINDER); cfg.setDiscoverySpi(discoSpi); g1GgfsCfg1.setName("g1GgfsCfg1"); g1GgfsCfg1.setDataCacheName(dataCache1Name); g1GgfsCfg1.setMetaCacheName(metaCache1Name); g1GgfsCfg2.setName("g1GgfsCfg2"); g1GgfsCfg2.setDataCacheName(dataCache2Name); g1GgfsCfg2.setMetaCacheName(metaCache2Name); cfg.setGgfsConfiguration(g1GgfsCfg1, g1GgfsCfg2); cfg.setLocalHost("127.0.0.1"); return cfg; }