/** {@inheritDoc} */ @Override public void close() throws IgniteException { g.close(); }
/** {@inheritDoc} */ @Override public void close() throws Exception { ignite.close(); }
@Override public Object call() throws Exception { ignite.close(); return null; } }, "stop-node");
/** * Stops the grid client. */ @Override public synchronized void stop() { if (stopped) return; stopped = true; stopRemoteListen(); IgniteGrid.getIgnite().close(); }
/** * Stops the grid client. */ @Override public void stop() { if (stopped) return; stopped = true; StreamerContext.getIgnite().close(); }
@Override public Object call() throws Exception { ignite.close(); return null; } }, "stop-node");
/** * Cleanup any state for this DB. Called once per DB instance; there is one DB * instance per client thread. */ @Override public void cleanup() throws DBException { synchronized (INIT_COUNT) { final int curInitCount = INIT_COUNT.decrementAndGet(); if (curInitCount <= 0) { cluster.close(); cluster = null; } if (curInitCount < 0) { // This should never happen. throw new DBException( String.format("initCount is negative: %d", curInitCount)); } } }
@Override public void run() { try { node.close(); } finally { latch.countDown(); } } });
/** {@inheritDoc} */ @Override public void close() throws SQLException { if (closed) return; closed = true; for (Iterator<JdbcStatement> it = statements.iterator(); it.hasNext();) { JdbcStatement stmt = it.next(); stmt.closeInternal(); it.remove(); } IgniteNodeFuture fut = NODES.get(cfg); if (fut != null && fut.release()) { NODES.remove(cfg); if (ignite != null) ignite.close(); } }
/** * @param i Idx. */ void stopPrimary(int i) { String name = "node" + i + primarySuffix; nodes.get(name).close(); nodes.remove(name); }
/** * Close ignite instance */ public void closeIgnite() { if (ignite != null) { getLogger().info("Closing ignite client"); ignite.close(); ignite = null; } }
@Override public void run() { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Shutdown imminent."); ignite.close(); } }).start();
@Override public Void call() throws Exception { int idx = nodeIdx.getAndIncrement(); log.info("Stop node: " + idx); ignite(idx).close(); return null; } }, 3, "stop-node");
/** * Stops the grid. */ @Override public synchronized void stop() { if (ignite != null) ignite.close(); sinkCounter.incrementConnectionClosedCount(); sinkCounter.stop(); super.stop(); }
/** * Stops streamer. * * @throws IgniteException If failed. */ public void stop() throws IgniteException { if (stopped) return; stopped = true; getIgnite().<K, V>dataStreamer(cacheName).close(true); getIgnite().close(); }
/** * Remove one random node. */ public void failNode() { if (srvs.isEmpty()) throw new IllegalStateException("Cannot remove node from empty cluster"); Ignite srv = srvs.get(rnd.nextInt(srvs.size())); IgniteConfiguration cfg = srv.configuration(); NodeConfiguration nodeCfg = new NodeConfiguration( ((TcpDiscoverySpi)cfg.getDiscoverySpi()).getIpFinder().getRegisteredAddresses().iterator().next().getPort(), Objects.requireNonNull(cfg.getClientConnectorConfiguration()).getPort() ); srv.close(); srvs.remove(srv); failedCfgs.add(nodeCfg); }
/** * @param client ignite instance. * @param predCls loaded predicate class. * @throws Exception if failed. */ private void invokeScanQueryAndStopClient(Ignite client, Class predCls) throws Exception { IgniteCache<Integer, String> cache = client.getOrCreateCache(CACHE_NAME); assertEquals("Invalid number of sent grid deployment requests", 0, MessageCountingCommunicationSpi.deploymentRequestCount()); assertFalse(PREDICATE_CLASSNAME + " mustn't be cached! ", igniteUtilsCachedClasses().contains(PREDICATE_CLASSNAME)); cache.query(new ScanQuery<>((IgniteBiPredicate<Integer, String>)predCls.newInstance())).getAll(); // first request is GridDeployment.java 716 and second is GridDeployment.java 501 assertEquals("Invalid number of sent grid deployment requests", 2, MessageCountingCommunicationSpi.deploymentRequestCount()); assertTrue(PREDICATE_CLASSNAME + " must be cached! ", igniteUtilsCachedClasses().contains(PREDICATE_CLASSNAME)); client.close(); assertFalse(PREDICATE_CLASSNAME + " mustn't be cached! ", igniteUtilsCachedClasses().contains(PREDICATE_CLASSNAME)); }
/** * @throws Exception If failed. */ @Test public void testJobCancel() throws Exception { Ignite server = startGrid("server"); server.services().deployNodeSingleton("my-service", new MyService()); Ignition.setClientMode(true); Ignite client = startGrid("client"); ComputeTaskFuture<Integer> fut = client.compute().executeAsync(new MyTask(), null); Thread.sleep(3000); server.close(); assertEquals(42, fut.get().intValue()); }
/** * @throws Exception If fail. */ @Test public void testCacheCreatePutCheckpointDestroy() throws Exception { IgniteEx ig = startGrid(0); ig.active(true); for (int j = 0; j < NUM_ITERATIONS; j++) { Ignite client = startGrid(1); for (int i = 0; i < NUM_CACHES; i++) { IgniteCache<?, ?> cache = ig.cache(NAME_PREFIX + i); if (cache != null) cache.destroy(); } populateCache(client); checkCacheSizes(client); client.close(); } }
/** * @throws Exception If failed. */ private void doTest() throws Exception { try { startGrids(GRID_CNT); Ignite ignite = grid(0); IgniteSemaphore sem = ignite.semaphore("sem", 1, true, true); assertEquals(1, sem.availablePermits()); sem.acquire(1); assertEquals(0, sem.availablePermits()); ignite.close(); awaitPartitionMapExchange(); IgniteSemaphore sem2 = grid(1).semaphore("sem", 1, true, true); assertTrue("Could not aquire after 'restart'",sem2.tryAcquire(1, 5000, TimeUnit.MILLISECONDS)); } finally { stopAllGrids(); } }