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

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

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

Ignition.state介绍

[英]Gets state of grid default grid.
[中]获取网格默认网格的状态。

代码示例

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

@Override public boolean apply() {
    return IgniteState.STOPPED_ON_SEGMENTATION == Ignition.state(ignite.name());
  }
}, 5000);

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

@Override public boolean apply() {
    return Ignition.state(slowClient.name()) == IgniteState.STOPPED_ON_SEGMENTATION;
  }
}, getTestTimeout());

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

/**
 * Creates instance of the HadoopIgfsInProcWithIgniteRefsCount by IGFS name.
 *
 * @param ignite Ignite instance.
 * @param igfsName Target IGFS name.
 * @param log Log.
 * @param userName User name.
 * @return HadoopIgfsInProcWithIgniteRefsCount instance. {@code null} if the IGFS not found
 *      in the specified ignite instance.
 */
private static HadoopIgfsInProc create0(Ignite ignite, String igfsName, Log log, String userName) {
  assert Thread.holdsLock(REF_CTR_MUX);
  assert ignite != null;
  if (Ignition.state(ignite.name()) == STARTED) {
    try {
      for (IgniteFileSystem fs : ignite.fileSystems()) {
        if (F.eq(fs.name(), igfsName)) {
          Integer ctr = REF_CTRS.get(ignite.name());
          if (ctr != null)
            REF_CTRS.put(ignite.name(), ctr + 1);
          return new HadoopIgfsInProc((IgfsEx)fs, log, userName);
        }
      }
    }
    catch (IllegalStateException ignore) {
      // May happen if the grid state has changed:
    }
  }
  return null;
}

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

/**
 * @throws Exception If failed.
 */
@Override protected void beforeTest() throws Exception {
  for (int i = 0; i < GRID_CNT; i++) {
    if (Ignition.state(IGNITEs.get(i).name()) == STOPPED) {
      info("Restarting grid: " + i);
      IGNITEs.set(i, startGrid(i));
    }
    assert !jcache(i).isLocalLocked(KEY, false) : "Entry is locked for grid [idx=" + i + ']';
  }
}

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

/**
 * @param ignite Ignite.
 * @throws Exception If failed.
 */
private void waitSegmented(final Ignite ignite) throws Exception {
  GridTestUtils.waitForCondition(new GridAbsPredicate() {
    @Override public boolean apply() {
      return IgniteState.STOPPED_ON_SEGMENTATION == Ignition.state(ignite.name());
    }
  }, 5000);
  assertEquals(IgniteState.STOPPED_ON_SEGMENTATION, Ignition.state(ignite.name()));
}

代码示例来源:origin: org.hibernate.ogm/hibernate-ogm-ignite

private <K, V> IgniteCache<K, V> getCache(String entityCacheName, boolean keepBinary) {
  IgniteCache<K, V> cache = null;
  try {
    cache = cacheManager.cache( entityCacheName );
  }
  catch (IllegalStateException ex) {
    if ( Ignition.state( gridName ) == IgniteState.STOPPED ) {
      log.stoppedIgnite();
      restart();
      cache = cacheManager.cache( entityCacheName );
    }
    else {
      throw ex;
    }
  }
  if ( cache == null ) {
    throw log.cacheNotFound( entityCacheName );
  }
  if ( keepBinary ) {
    cache = cache.withKeepBinary();
  }
  return cache;
}

相关文章