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

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

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

Ignition.getOrStart介绍

[英]Gets or starts new grid instance if it hasn't been started yet.
[中]获取或启动尚未启动的新网格实例。

代码示例

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

/**
 * Tests default Ignite instance
 */
@Test
public void testDefaultIgniteInstanceGetOrStart() throws Exception {
  IgniteConfiguration cfg = getConfiguration(null);
  try(Ignite ignite = Ignition.getOrStart(cfg)) {
    try {
      Ignition.start(cfg);
      fail("Expected exception after grid started");
    }
    catch (IgniteException ignored) {
    }
    Ignite ignite2 = Ignition.getOrStart(cfg);
    assertEquals("Must return same instance", ignite, ignite2);
  }
}

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

/**
   * Tests named Ignite instance
   */
  @Test
  public void testNamedIgniteInstanceGetOrStart() throws Exception {
    IgniteConfiguration cfg = getConfiguration("test");
    try(Ignite ignite = Ignition.getOrStart(cfg)) {
      try {
        Ignition.start(cfg);
        fail("Expected exception after grid started");
      }
      catch (IgniteException ignored) {
      }
      Ignite ignite2 = Ignition.getOrStart(cfg);
      assertEquals("Must return same instance", ignite, ignite2);
    }
  }
}

代码示例来源:origin: marcosbarbero/spring-cloud-zuul-ratelimit

@Bean
@Qualifier("RateLimit")
public IgniteCache<String, GridBucketState> cache() {
  ignite = Ignition.getOrStart(new IgniteConfiguration());
  return ignite.getOrCreateCache("rateLimit");
}

代码示例来源:origin: marcosbarbero/spring-cloud-zuul-ratelimit

@Bean
@Qualifier("RateLimit")
public IgniteCache<String, GridBucketState> cache() {
  ignite = Ignition.getOrStart(new IgniteConfiguration());
  return ignite.getOrCreateCache("rateLimit");
}

相关文章