本文整理了Java中org.apache.ignite.Ignite.close()
方法的一些代码示例,展示了Ignite.close()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ignite.close()
方法的具体详情如下:
包路径:org.apache.ignite.Ignite
类名称:Ignite
方法名:close
[英]Closes this instance of grid. This method is identical to calling G#stop(String,boolean).
The method is invoked automatically on objects managed by the try-with-resources statement.
[中]关闭此网格实例。此方法与调用G#stop(字符串,布尔值)相同。
该方法在try with resources语句管理的对象上自动调用。
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void close() throws IgniteException {
g.close();
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void close() throws Exception {
ignite.close();
}
代码示例来源:origin: apache/ignite
@Override public Object call() throws Exception {
ignite.close();
return null;
}
}, "stop-node");
代码示例来源:origin: apache/ignite
/**
* Stops the grid client.
*/
@Override public synchronized void stop() {
if (stopped)
return;
stopped = true;
stopRemoteListen();
IgniteGrid.getIgnite().close();
}
代码示例来源:origin: apache/ignite
/**
* Stops the grid client.
*/
@Override public void stop() {
if (stopped)
return;
stopped = true;
StreamerContext.getIgnite().close();
}
代码示例来源:origin: apache/ignite
@Override public Object call() throws Exception {
ignite.close();
return null;
}
}, "stop-node");
代码示例来源:origin: brianfrankcooper/YCSB
/**
* 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));
}
}
}
代码示例来源:origin: apache/ignite
@Override public void run() {
try {
node.close();
}
finally {
latch.countDown();
}
}
});
代码示例来源:origin: apache/ignite
/** {@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();
}
}
代码示例来源:origin: apache/ignite
/**
* @param i Idx.
*/
void stopPrimary(int i) {
String name = "node" + i + primarySuffix;
nodes.get(name).close();
nodes.remove(name);
}
代码示例来源:origin: apache/nifi
/**
* Close ignite instance
*/
public void closeIgnite() {
if (ignite != null) {
getLogger().info("Closing ignite client");
ignite.close();
ignite = null;
}
}
代码示例来源:origin: apache/ignite
@Override public void run() {
try {
Thread.sleep(3000);
}
catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Shutdown imminent.");
ignite.close();
}
}).start();
代码示例来源:origin: apache/ignite
@Override public Void call() throws Exception {
int idx = nodeIdx.getAndIncrement();
log.info("Stop node: " + idx);
ignite(idx).close();
return null;
}
}, 3, "stop-node");
代码示例来源:origin: apache/ignite
/**
* Stops the grid.
*/
@Override public synchronized void stop() {
if (ignite != null)
ignite.close();
sinkCounter.incrementConnectionClosedCount();
sinkCounter.stop();
super.stop();
}
代码示例来源:origin: apache/ignite
/**
* 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();
}
代码示例来源:origin: apache/ignite
/**
* 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);
}
代码示例来源:origin: apache/ignite
/**
* @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));
}
代码示例来源:origin: apache/ignite
/**
* @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());
}
代码示例来源:origin: apache/ignite
/**
* @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();
}
}
代码示例来源:origin: apache/ignite
/**
* @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();
}
}
内容来源于网络,如有侵权,请联系作者删除!