Java Code Examples for org.apache.ignite.Ignition#stopAll()
The following examples show how to use
org.apache.ignite.Ignition#stopAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IgnitePersistentStoreTest.java From ignite with Apache License 2.0 | 6 votes |
/** */ @Test public void pojoStrategyTransactionTest() { CassandraHelper.dropTestKeyspaces(); Ignition.stopAll(true); try (Ignite ignite = Ignition.start("org/apache/ignite/tests/persistence/pojo/ignite-config.xml")) { pojoStrategyTransactionTest(ignite, TransactionConcurrency.OPTIMISTIC, TransactionIsolation.READ_COMMITTED); pojoStrategyTransactionTest(ignite, TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ); pojoStrategyTransactionTest(ignite, TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE); pojoStrategyTransactionTest(ignite, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.READ_COMMITTED); pojoStrategyTransactionTest(ignite, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); pojoStrategyTransactionTest(ignite, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.SERIALIZABLE); } }
Example 2
Source File: IgniteComputeCustomExecutorConfigurationSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @throws Exception If failed. */ @Test public void testConfigurations() throws Exception { try { checkStartWithInvalidConfiguration(getConfiguration("node0") .setExecutorConfiguration(new ExecutorConfiguration())); checkStartWithInvalidConfiguration(getConfiguration("node0") .setExecutorConfiguration(new ExecutorConfiguration(""))); checkStartWithInvalidConfiguration(getConfiguration("node0") .setExecutorConfiguration(new ExecutorConfiguration("exec").setSize(-1))); checkStartWithInvalidConfiguration(getConfiguration("node0") .setExecutorConfiguration(new ExecutorConfiguration("exec").setSize(0))); } finally { Ignition.stopAll(true); } }
Example 3
Source File: FetchingQueryCursorStressTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Entry point. */ public static void main(String[] args) throws Exception { List<Thread> threads = new ArrayList<>(THREAD_CNT + 1); try (Ignite ignite = start()) { IgniteCache<Integer, Person> cache = ignite.cache(CACHE_NAME); loadData(ignite, cache); System.out.println("Loaded data: " + cache.size()); for (int i = 0; i < THREAD_CNT; i++) threads.add(startDaemon("qry-exec-" + i, new QueryExecutor(cache, "Select * from Person"))); threads.add(startDaemon("printer", new ThroughputPrinter())); Thread.sleep(TIMEOUT); for (Thread t : threads) t.join(); if (error.get() != null) throw error.get(); } finally { Ignition.stopAll(false); } }
Example 4
Source File: GridCacheTtlManagerEvictionSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param mode Cache mode. * @throws Exception If failed. */ @SuppressWarnings("ConstantConditions") private void checkEviction(CacheMode mode) throws Exception { cacheMode = mode; final IgniteKernal g = (IgniteKernal)startGrid(0); try { final IgniteCache<Object, Object> cache = g.cache(DEFAULT_CACHE_NAME); final GridCacheContext<Object, Object> cctx = g.cachex(DEFAULT_CACHE_NAME).context(); for (int i = 1; i <= ENTRIES_TO_PUT; i++) { String key = "Some test entry key#" + i; String value = "Some test entry value#" + i; cache.put(key, value); } if (log.isTraceEnabled()) cctx.ttl().printMemoryStats(); final String firstKey = "Some test entry key#1"; final String lastKey = "Some test entry key#" + ENTRIES_TO_PUT; assertNull("first key should be evicted", cache.localPeek(firstKey, CachePeekMode.ONHEAP)); assertNotNull("last key should NOT be evicted", cache.localPeek(lastKey, CachePeekMode.ONHEAP)); assertEquals("Ttl Manager should NOT track evicted entries", ENTRIES_LIMIT, cctx.ttl().pendingSize()); } finally { Ignition.stopAll(true); } }
Example 5
Source File: IgniteCacheObjectKeyIndexingSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected void afterTestsStopped() throws Exception { Ignition.stopAll(true); cleanPersistenceDir(); }
Example 6
Source File: JmhSequenceBenchmark.java From ignite with Apache License 2.0 | 4 votes |
/** * Tear down routine. */ @TearDown public void tearDown() { Ignition.stopAll(true); }
Example 7
Source File: JmhStreamerAddDataBenchmark.java From ignite with Apache License 2.0 | 4 votes |
/** * Stop all grids after tests. */ @TearDown(Level.Trial) public void tearDown() { Ignition.stopAll(true); }
Example 8
Source File: JmhWaitStategyBenchmark.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @TearDown @Override public void tearDown() throws Exception { Ignition.stopAll(true); }
Example 9
Source File: IgniteNode.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override public void stop() throws Exception { Ignition.stopAll(true); }
Example 10
Source File: PlatformJavaObjectFactoryProxySelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { ctx = null; Ignition.stopAll(true); }
Example 11
Source File: GridServiceProcessorStopSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * @throws Exception If failed. */ @Test public void testStopDuringDeployment() throws Exception { final CountDownLatch depLatch = new CountDownLatch(1); final CountDownLatch finishLatch = new CountDownLatch(1); final Ignite ignite = startGrid(0); IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Void>() { @Override public Void call() throws Exception { IgniteServices svcs = ignite.services(); IgniteFuture f = svcs.deployClusterSingletonAsync("myClusterSingletonService", new TestServiceImpl()); depLatch.countDown(); try { f.get(); } catch (IgniteException ignored) { finishLatch.countDown(); } finally { finishLatch.countDown(); } return null; } }, "deploy-thread"); depLatch.await(); Ignition.stopAll(true); boolean wait = finishLatch.await(15, TimeUnit.SECONDS); if (!wait) U.dumpThreads(log); assertTrue("Deploy future isn't completed", wait); fut.get(); }
Example 12
Source File: GridCacheConditionalDeploymentSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected void afterTestsStopped() throws Exception { Ignition.stopAll(true); }
Example 13
Source File: AgentClusterDemo.java From ignite with Apache License 2.0 | 3 votes |
/** */ public static void stop() { demoUrl = null; Ignition.stopAll(true); initLatch = new CountDownLatch(1); initGuard.compareAndSet(true, false); }
Example 14
Source File: IgnitePersistentStoreTest.java From ignite with Apache License 2.0 | 2 votes |
/** */ @Test public void loadCacheTest() { Ignition.stopAll(true); LOGGER.info("Running loadCache test"); LOGGER.info("Filling Cassandra table with test data"); CacheStore store = CacheStoreHelper.createCacheStore("personTypes", new ClassPathResource("org/apache/ignite/tests/persistence/pojo/persistence-settings-3.xml"), CassandraHelper.getAdminDataSrc()); Collection<CacheEntryImpl<PersonId, Person>> entries = TestsHelper.generatePersonIdsPersonsEntries(); //noinspection unchecked store.writeAll(entries); LOGGER.info("Cassandra table filled with test data"); LOGGER.info("Running loadCache test"); try (Ignite ignite = Ignition.start("org/apache/ignite/tests/persistence/pojo/ignite-config.xml")) { CacheConfiguration<PersonId, Person> ccfg = new CacheConfiguration<>("cache3"); IgniteCache<PersonId, Person> personCache3 = ignite.getOrCreateCache(ccfg); int size = personCache3.size(CachePeekMode.ALL); LOGGER.info("Initial cache size " + size); LOGGER.info("Loading cache data from Cassandra table"); String qry = "select * from test1.pojo_test3 limit 3"; personCache3.loadCache(null, qry); size = personCache3.size(CachePeekMode.ALL); Assert.assertEquals("Cache data was incorrectly loaded from Cassandra table by '" + qry + "'", 3, size); personCache3.clear(); personCache3.loadCache(null, new SimpleStatement(qry)); size = personCache3.size(CachePeekMode.ALL); Assert.assertEquals("Cache data was incorrectly loaded from Cassandra table by statement", 3, size); personCache3.clear(); personCache3.loadCache(null); size = personCache3.size(CachePeekMode.ALL); Assert.assertEquals("Cache data was incorrectly loaded from Cassandra. " + "Expected number of records is " + TestsHelper.getBulkOperationSize() + ", but loaded number of records is " + size, TestsHelper.getBulkOperationSize(), size); LOGGER.info("Cache data loaded from Cassandra table"); } LOGGER.info("loadCache test passed"); }
Example 15
Source File: JmhCacheAbstractBenchmark.java From ignite with Apache License 2.0 | 2 votes |
/** * Tear down routine. * * @throws Exception If failed. */ @TearDown public void tearDown() throws Exception { Ignition.stopAll(true); }
Example 16
Source File: GridServiceProcessorStopSelfTest.java From ignite with Apache License 2.0 | 2 votes |
/** * @throws Exception If failed. */ @Test public void testStopDuringHangedDeployment() throws Exception { final CountDownLatch depLatch = new CountDownLatch(1); final CountDownLatch finishLatch = new CountDownLatch(1); final IgniteEx node0 = startGrid(0); final IgniteEx node1 = startGrid(1); final IgniteEx node2 = startGrid(2); final IgniteCache<Object, Object> cache = node2.getOrCreateCache(new CacheConfiguration<Object, Object>("def") .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)); node0.services().deployNodeSingleton("myService", new TestServiceImpl()); // Guarantee lock owner will never left topology unexpectedly. final Integer lockKey = keyForNode(node2.affinity("def"), new AtomicInteger(1), node2.cluster().localNode()); // Lock to hold topology version undone. final Lock lock = cache.lock(lockKey); // Try to change topology once service has deployed. IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Void>() { @Override public Void call() throws Exception { depLatch.await(); node1.close(); return null; } }, "top-change-thread"); // Stop node on unstable topology. GridTestUtils.runAsync(new Callable<Void>() { @Override public Void call() throws Exception { depLatch.await(); Thread.sleep(1000); node0.close(); finishLatch.countDown(); return null; } }, "stopping-node-thread"); assertNotNull(node0.services().service("myService")); // Freeze topology changing lock.lock(); depLatch.countDown(); boolean wait = finishLatch.await(15, TimeUnit.SECONDS); if (!wait) U.dumpThreads(log); assertTrue("Deploy future isn't completed", wait); fut.get(); Ignition.stopAll(true); }