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

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

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

Ignite.name介绍

[英]Gets the name of the Ignite instance. The name allows having multiple Ignite instances with different names within the same Java VM.

If default Ignite instance is used, then null is returned. Refer to Ignition documentation for information on how to start named ignite Instances.
[中]获取Ignite实例的名称。该名称允许在同一Java VM中具有多个具有不同名称的Ignite实例。
如果使用默认Ignite实例,则返回null。有关如何启动命名ignite实例的信息,请参阅点火文档。

代码示例

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

/**
 * Constructor.
 */
S3TimeoutWorker() {
  super(ignite.name(), "grid-s3-checkpoint-worker", log);
}

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

/** {@inheritDoc} */
  @Override public Object call() {
    log.info("!!!!! I am job " + param + " on " + ignite.name());

    return  42;
  }
}

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

/** {@inheritDoc} */
  @Override public Object call() {
    log.info("!!!!! I am job_2 " + param + " on " + ignite.name());

    return 42;
  }
}

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

/**
 * Inject ignite instance.
 *
 * @param ignite Ignite instance.
 */
@IgniteInstanceResource
protected void injectResources(Ignite ignite) {
  this.ignite = ignite;
  if (ignite != null)
    igniteInstanceName = ignite.name();
}

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

/**
 * Stop all instances.
 *
 * @param cancel Cancel flag.
 */
public static synchronized void stopAll(boolean cancel) {
  for (PlatformProcessor proc : instances.values())
    Ignition.stop(proc.ignite().name(), cancel);
  instances.clear();
}

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

@Override public void run() {
    U.error(log, "Stopping local node on Ignite failure: [failureCtx=" + failureCtx + ']');
    IgnitionEx.stop(ignite.name(), true, true);
    latch.countDown();
  }
},

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

/**
 * @param grids Grids to stop.
 */
private void stopGrids(Iterable<Ignite> grids) {
  for (Ignite g : grids)
    stopGrid(g.name());
}

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

@Override public void run() {
    U.error(ignite.log(), "Stopping local node on Ignite failure: [failureCtx=" + failureCtx + ']');
    IgnitionEx.stop(ignite.name(), true, true);
  }
},

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

/** @param grids Grids to stop. */
private void stopGrids(Iterable<Ignite> grids) {
  for (Ignite g : grids)
    stopGrid(g.name());
}

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

/** {@inheritDoc} */
  @Override public String toString() {
    return S.toString(CacheEventListener.class, this, "latchCount", latch.getCount(),
      "grid", ignite != null ? ignite.name() : "N/A", "evts", evts);
  }
}

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

/** {@inheritDoc} */
  @Override public synchronized CacheStore create() {
    String igniteInstanceName = ignite.name();
    return firstStores.computeIfAbsent(igniteInstanceName, (k) -> new TestStore());
  }
}

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

/**
 * @param nodeIds Node IDs.
 * @return Ignite instance names.
 */
private Collection<String> igniteInstanceNames(Collection<UUID> nodeIds) {
  Collection<String> names = new ArrayList<>(nodeIds.size());
  for (UUID nodeId : nodeIds)
    names.add(G.ignite(nodeId).name());
  return names;
}

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

/**
 * Applies specified closure to each cluster node.
 */
protected void testAllNodes(Consumer<Ignite> consumer) {
  for (Ignite node : Ignition.allGrids()) {
    log.info("Testing on node " + node.name() + '.');
    consumer.accept(node);
    log.info("Testing on node " + node.name() + " is done.");
  }
}

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

@Override public String call() throws Exception {
    assertFalse(ignite.configuration().isClientMode());
    return ignite.name();
  }
});

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

@Override public boolean apply(ClusterNode n) {
    String igniteInstanceName = G.ignite(n.id()).name();
    return igniteInstanceName != null && igniteInstanceName.contains("server");
  }
};

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

@Override public boolean apply(ClusterNode n) {
    String igniteInstanceName = G.ignite(n.id()).name();
    return igniteInstanceName != null && igniteInstanceName.contains("client");
  }
};

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

/** {@inheritDoc} */
@Override public void store(@Nullable String cacheName, Object key, Object val, long expirationTime) {
  if (err && ignite.name().endsWith("IgniteErrorOnRebalanceTest1")) {
    ignite.log().warning("Test error on store [cache=" + cacheName + ", key=" + key + ']');
    throw new IgniteSpiException("Test error");
  }
}

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

/**
 * @param ignite Grid.
 */
private void stopGrid(Ignite ignite) {
  try {
    if (ignite != null)
      stopGrid(ignite.name());
  }
  catch (Throwable e) {
    error("Got error when stopping grid.", e);
  }
}

代码示例来源: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: apache/ignite

@Override public Void call() throws Exception {
    int node = idx.getAndIncrement() % GRID_CNT;
    Ignite ignite = grid(node);
    log.info("Add configuration using node: " + ignite.name());
    CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    cfg.setName("org.apache.ignite" + iter + "*");
    cfg.setBackups(iter);
    for (int i = 0; i < 100; i++)
      ignite.addCacheConfiguration(cfg);
    return null;
  }
}, 15, "add-configuration");

相关文章