本文整理了Java中org.apache.ignite.internal.util.typedef.F.first()
方法的一些代码示例,展示了F.first()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。F.first()
方法的具体详情如下:
包路径:org.apache.ignite.internal.util.typedef.F
类名称:F
方法名:first
暂无
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Nullable @Override public Object reduce(List<ComputeJobResult> results) throws IgniteException {
assert results.size() == 1;
ComputeJobResult res = F.first(results);
assert res != null;
IgniteException ex = res.getException();
if (ex != null)
throw ex;
return res.getData();
}
代码示例来源:origin: apache/ignite
/**
* @param nodes Nodes.
* @return Backup nodes.
*/
public static Collection<ClusterNode> backups(Collection<ClusterNode> nodes) {
if (nodes == null || nodes.size() <= 1)
return Collections.emptyList();
return F.view(nodes, F.notEqualTo(F.first(nodes)));
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override @Nullable public ClusterNode mapKeyToNode(K key) {
A.notNull(key, "key");
return F.first(mapKeysToNodes(F.asList(key)).keySet());
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
Long ptr) {
return Collections.singletonMap(new Job(ptr, F.first(subgrid)), F.first(subgrid));
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
@Nullable Object arg) {
return Collections.singletonMap(new MaxMemoryJob(), F.first(subgrid));
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
@Nullable String arg) throws IgniteException {
return Collections.singletonMap(new PlatformStartIgniteJob(arg), F.first(subgrid));
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
@Nullable String arg) {
return Collections.singletonMap(new StringTestTaskJob(arg), F.first(subgrid));
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
@Nullable String arg) throws IgniteException {
return Collections.singletonMap(new SqlQueryJob(arg), F.first(subgrid));
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
@Nullable String serviceName) throws IgniteException {
return Collections.singletonMap(new PlatformDeployServiceJob(serviceName), F.first(subgrid));
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public String reduce(List<ComputeJobResult> results) {
return F.first(results).getData();
}
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Nullable @Override public String fileName() {
FileAppender fapp = F.first(fileAppenders);
return fapp != null ? fapp.getFile() : null;
}
代码示例来源:origin: apache/ignite
/** @throws Exception If failed. */
@Test
public void testEmptyGrid() throws Exception {
QueryCursor<List<?>> qry = personCache
.query(sqlFieldsQuery("select name, age from Person where age = 25"));
List<?> res = F.first(qry.getAll());
assert res != null;
assert res.size() == 2;
assert "John White".equals(res.get(0));
assert res.get(1).equals(25);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Test
@Override public void testSendToManyNodes() throws Exception {
super.testSendToManyNodes();
// Test idle clients remove.
for (CommunicationSpi spi : spis.values()) {
ConcurrentMap<UUID, GridCommunicationClient> clients = U.field(spi, "clients");
assertEquals(getSpiCount() - 1, clients.size());
clients.put(UUID.randomUUID(), F.first(clients.values()));
}
}
代码示例来源:origin: apache/ignite
@Override public void run(IgniteCache<String, Integer> cache) throws IgniteCheckedException {
Map.Entry<String, Integer> e = F.first(pairs(1).entrySet());
assert e != null;
String key = e.getKey();
Integer val = e.getValue();
cache.put(key, val);
assert cache.containsKey(key);
assert cache.remove(key);
assert !cache.containsKey(key);
}
}, F.t(EVT_CACHE_OBJECT_PUT, gridCnt), F.t(EVT_CACHE_OBJECT_REMOVED, gridCnt));
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void allowOverwrite(boolean allow) {
if (allow == allowOverwrite())
return;
ClusterNode node = F.first(ctx.grid().cluster().forCacheNodes(cacheName).nodes());
if (node == null)
throw new CacheException("Failed to get node for cache: " + cacheName);
rcvr = allow ? DataStreamerCacheUpdaters.<K, V>individual() : ISOLATED_UPDATER;
}
代码示例来源:origin: apache/ignite
@Override public void run(IgniteCache<String, Integer> cache) throws IgniteCheckedException {
Map.Entry<String, Integer> e = F.first(pairs(1).entrySet());
assert e != null;
String key = e.getKey();
Integer val = e.getValue();
assert cache.getAndPutAsync(key, val).get() == null;
assert cache.containsKey(key);
assert val.equals(cache.getAsync(key).get());
assert val.equals(cache.getAndRemoveAsync(key).get());
assert !cache.containsKey(key);
}
}, F.t(EVT_CACHE_OBJECT_PUT, gridCnt), F.t(EVT_CACHE_OBJECT_READ, 3), F.t(EVT_CACHE_OBJECT_REMOVED, gridCnt));
代码示例来源:origin: apache/ignite
/**
* @param cctx Cctx.
* @return Local partition.
*/
private static int anyLocalPartition(GridCacheContext<?, ?> cctx) {
return F.first(cctx.topology().localPartitions()).id();
}
代码示例来源:origin: apache/ignite
/**
* @throws Exception If failed.
*/
@Test
public void testVersion() throws Exception {
Map<SocketAddress, String> map = client.getVersions();
Assert.assertEquals(1, map.size());
String ver = F.first(map.values());
Assert.assertFalse(F.isEmpty(ver));
}
代码示例来源:origin: apache/ignite
@Override public IgniteFuture<?> applyx(ClusterGroup prj) {
Affinity<Object> aff = prj.ignite().affinity(DEFAULT_CACHE_NAME);
ClusterNode node = F.first(prj.nodes());
return compute(prj).affinityCallAsync(DEFAULT_CACHE_NAME, keyForNode(aff, node), new TestCallable());
}
});
代码示例来源:origin: apache/ignite
/**
* @throws Exception If failed.
*/
@Test
@Override public void testConnectable() throws Exception {
GridClient client = client();
List<GridClientNode> nodes = client.compute().refreshTopology(false, false);
assertFalse(F.first(nodes).connectable());
}
}
内容来源于网络,如有侵权,请联系作者删除!