本文整理了Java中org.apache.ignite.Ignite.cacheNames()
方法的一些代码示例,展示了Ignite.cacheNames()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ignite.cacheNames()
方法的具体详情如下:
包路径:org.apache.ignite.Ignite
类名称:Ignite
方法名:cacheNames
[英]Gets the collection of names of currently available caches.
[中]获取当前可用缓存的名称集合。
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public Collection<String> cacheNames() {
checkIgnite();
return g.cacheNames();
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public Collection<String> cacheNames() {
return locJvmGrid.cacheNames();
}
代码示例来源:origin: apache/ignite
@Override public boolean apply() {
for (Ignite node0 : Ignition.allGrids()) {
if (!node0.cacheNames().isEmpty())
return false;
}
return true;
}
}, 2000));
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
clearIoState();
Ignite cli = client();
cli.destroyCaches(cli.cacheNames());
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception In case of failure.
*/
@Test
public void testCacheNames() throws Exception {
try {
startGridsMultiThreaded(2);
Collection<String> names = grid(0).cacheNames();
assertEquals(3, names.size());
for (String name : names)
assertTrue(DEFAULT_CACHE_NAME.equals(name) || name.equals("replicated") || name.equals("partitioned"));
client = true;
Ignite client = startGrid(2);
names = client.cacheNames();
assertEquals(3, names.size());
}
finally {
stopAllGrids();
}
}
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
super.afterTest();
for(String cacheName : ignite().cacheNames())
ignite().cache(cacheName).destroy();
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void processOutStream(int type, BinaryRawWriterEx writer) throws IgniteCheckedException {
switch (type) {
case OP_GET_IGNITE_CONFIGURATION: {
PlatformConfigurationUtils.writeIgniteConfiguration(writer, ignite().configuration(), CURRENT_VER);
return;
}
case OP_GET_CACHE_NAMES: {
Collection<String> names = ignite().cacheNames();
writer.writeInt(names.size());
for (String name : names)
writer.writeString(name);
return;
}
case OP_GET_BASELINE_TOPOLOGY: {
Collection<BaselineNode> blt = ignite().cluster().currentBaselineTopology();
writer.writeInt(blt.size());
for (BaselineNode n : blt) {
writer.writeObjectDetached(n.consistentId());
PlatformUtils.writeNodeAttributes(writer, n.attributes());
}
return;
}
}
PlatformAbstractTarget.throwUnsupported(type);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
for (Ignite node0 : Ignition.allGrids()) {
Collection<String> cacheNames = node0.cacheNames();
for (String cacheName : cacheNames)
destroyCache(node0, cacheName);
}
awaitPartitionMapExchange();
assertTrue(GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
for (Ignite node0 : Ignition.allGrids()) {
if (!node0.cacheNames().isEmpty())
return false;
}
return true;
}
}, 2000));
}
代码示例来源:origin: apache/ignite
for (String cache : ignite(0).cacheNames())
ignite(0).destroyCache(cache);
代码示例来源:origin: apache/ignite
/**
* Execute certain logic for all nodes.
*
* @param task Task.
* @throws Exception If failed.
*/
protected void forAllNodes(IgniteInClosureX<Ignite> task) throws Exception {
for (Ignite node : Ignition.allGrids()) {
try {
info("");
info(">>> Executing test on node: " + node.name());
task.applyx(node);
}
finally {
for (Ignite node0 : Ignition.allGrids()) {
Collection<String> cacheNames = node0.cacheNames();
for (String cacheName : cacheNames)
destroyCache(node0, cacheName);
}
}
}
}
代码示例来源:origin: apache/ignite
/**
* @param ignite Ignite.
*/
protected void checkDestroyCaches(Ignite ignite) throws Exception {
loadCaches(ignite);
log.warning("destroying caches....");
ignite.cache(cacheName(0)).destroy();
ignite.cache(cacheName(1)).destroy();
assertEquals(CACHES - 2, ignite.cacheNames().size());
log.warning("Stopping grid");
stopAllGrids(false);
log.warning("Grid stopped");
log.warning("Starting grid");
ignite = startGrids(NODES);
ignite.cluster().active(true);
log.warning("Grid started");
assertEquals("Check that caches don't survived", CACHES - 2, ignite.cacheNames().size());
for(Ignite ig: G.allGrids()) {
IgniteCache cache = ig.cache(cacheName(2));
for (int j = 0; j < NUM_OF_KEYS; j++)
assertNotNull("Check that cache2 contains key: " + j + " node: " + ignite.name(), cache.get(j));
}
}
代码示例来源:origin: apache/ignite
assertFalse(ignite(0).cacheNames().contains("AaAaBB"));
assertFalse(ignite(0).cacheNames().contains("AaAaBB"));
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void run() {
IgniteLogger log = localNode.log();
log.info("Start local rebalancing caches");
for (String cacheName : localNode.cacheNames()) {
IgniteCache<?, ?> cache = localNode.cache(cacheName);
assertNotNull(cache);
boolean finished;
log.info("Start rebalancing cache: " + cacheName + ", size: " + cache.localSize());
do {
IgniteFuture<?> rebalance = cache.rebalance();
log.info("Wait rebalancing cache: " + cacheName + " - " + rebalance);
finished = (Boolean)rebalance.get();
log.info("Rebalancing cache: " + cacheName + " - " + rebalance);
if (finished) {
log.info("Finished rebalancing cache: " + cacheName + ", size: " +
cache.localSize(CachePeekMode.PRIMARY) + cache.localSize(CachePeekMode.BACKUP));
} else
log.info("Rescheduled rebalancing cache: " + cacheName + ", size: " + cache.localSize());
}
while (!finished);
}
log.info("Finished local rebalancing caches");
}
}
代码示例来源:origin: apache/ignite
assertFalse(ignite(0).cacheNames().contains(CACHE2));
assertFalse(ignite(0).cacheNames().contains(CACHE2));
代码示例来源:origin: apache/ignite
assertFalse(ignite(0).cacheNames().contains("cache2"));
assertFalse(ignite(0).cacheNames().contains("cache2"));
代码示例来源:origin: apache/ignite
assertFalse(ignite(0).cacheNames().contains("cache1"));
assertFalse(ignite(0).cacheNames().contains("cache1"));
代码示例来源:origin: apache/ignite
assertFalse(ignite(0).cacheNames().contains("AaAaAa"));
assertFalse(ignite(0).cacheNames().contains("AaAaAa"));
代码示例来源:origin: apache/ignite
assertFalse(ignite(0).cacheNames().contains(CACHE2));
assertFalse(ignite(0).cacheNames().contains(CACHE2));
代码示例来源:origin: apache/ignite
/**
* @param ignite Ignite instance.
*/
protected void checkDestroyCachesAbruptly(Ignite ignite) throws Exception {
loadCaches(ignite);
log.warning("Destroying caches");
((GatewayProtectedCacheProxy)ignite.cache(cacheName(0))).destroyAsync();
((GatewayProtectedCacheProxy)ignite.cache(cacheName(1))).destroyAsync();
log.warning("Stopping grid");
stopAllGrids();
log.warning("Grid stopped");
log.warning("Starting grid");
ignite = startGrids(NODES);
ignite.cluster().active(true);
log.warning("Grid started");
for(Ignite ig: G.allGrids()) {
assertTrue(ig.cacheNames().contains(cacheName(2)));
IgniteCache cache = ig.cache(cacheName(2));
for (int j = 0; j < NUM_OF_KEYS; j++)
assertNotNull("Check that survived cache cache2 contains key: " + j + " node: " + ig.name(), cache.get(j));
}
}
代码示例来源:origin: apache/ignite
cli.destroyCaches(cli.cacheNames());
内容来源于网络,如有侵权,请联系作者删除!