org.apache.ignite.Ignition.stopAll()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.apache.ignite.Ignition.stopAll()方法的一些代码示例,展示了Ignition.stopAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ignition.stopAll()方法的具体详情如下:
包路径:org.apache.ignite.Ignition
类名称:Ignition
方法名:stopAll

Ignition.stopAll介绍

[英]Stops all started grids in current JVM. If cancel flag is set to true then all jobs currently executing on local node will be interrupted. If wait parameter is set to true then grid will wait for all tasks to be finished.

Note: it is usually safer and more appropriate to stop grid instances individually instead of blanket operation. In most cases, the party that started the grid instance should be responsible for stopping it.
[中]停止当前JVM中所有启动的网格。如果取消标志设置为true,则当前在本地节点上执行的所有作业都将中断。若wait参数设置为true,则网格将等待所有任务完成。
注意:单独停止网格实例通常比整体操作更安全、更合适。在大多数情况下,启动网格实例的一方应该负责停止它。

代码示例

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
  ctx = null;
  Ignition.stopAll(true);
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override protected void afterTestsStopped() throws Exception {
  Ignition.stopAll(true);
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override protected void afterTestsStopped() throws Exception {
  Ignition.stopAll(true);
}

代码示例来源:origin: apache/ignite

/**
 * 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);
  }
}

代码示例来源:origin: apache/ignite

Ignition.stopAll(true);

代码示例来源:origin: apache/ignite

timer.interrupt();
Ignition.stopAll(true);

代码示例来源:origin: apache/ignite

Ignition.stopAll(true);

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
  assert testsCfg != null;
  if (Ignition.allGrids().size() != testsCfg.gridCount()) {
    info("All nodes will be stopped, new " + testsCfg.gridCount() + " nodes will be started.");
    Ignition.stopAll(true);
    FileUtils.deleteDirectory(workDir);
    info("Ignite's 'work' directory has been cleaned.");
    startGrids(testsCfg.gridCount());
    for (int i = 0; i < testsCfg.gridCount(); i++)
      info("Grid " + i + ": " + grid(i).localNode().id());
  }
  assert testsCfg.testedNodeIndex() >= 0 : "testedNodeIdx: " + testedNodeIdx;
  testedNodeIdx = testsCfg.testedNodeIndex();
  if (testsCfg.withClients()) {
    for (int i = 0; i < gridCount(); i++)
      assertEquals("i: " + i, expectedClient(getTestIgniteInstanceName(i)),
        (boolean)grid(i).configuration().isClientMode());
  }
}

代码示例来源:origin: apache/ignite

Ignition.stopAll(true);

代码示例来源:origin: apache/ignite

/**
 * @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);
  }
}

代码示例来源:origin: apache/ignite

info("All nodes will be stopped, new " + cnt + " nodes will be started.");
Ignition.stopAll(true);

相关文章