org.apache.ignite.internal.util.typedef.F.rand()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(78)

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

F.rand介绍

暂无

代码示例

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

/** {@inheritDoc} */
@Override public final ClusterGroup forRandom() {
  if (!F.isEmpty(ids))
    return forNodeId(F.rand(ids));
  Collection<ClusterNode> nodes = nodes();
  if (nodes.isEmpty())
    return new ClusterGroupAdapter(ctx, null, Collections.<UUID>emptySet());
  return forNode(F.rand(nodes));
}

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

/** {@inheritDoc} */
@Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
  @Nullable Void arg) {
  return F.asMap(new ComputeJobAdapter() {
    @TaskSessionResource
    private ComputeTaskSession ses;
    @Override public Object execute() {
      return ses.getTaskName();
    }
  }, F.rand(subgrid));
}

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

/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
  for (int i = 0; i < PERM_NODES_CNT; i++) {
    Ignite g = startGrid(gridCntr++);
    g.events().localListen(lsnr, EventType.EVT_NODE_LEFT, EventType.EVT_NODE_FAILED);
    alive.add(g);
  }
  for (int i = 0; i < PERM_NODES_CNT + TMP_NODES_CNT; i++)
    F.rand(alive).cache(DEFAULT_CACHE_NAME).put(i, String.valueOf(i));
}

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

/**
 * @return Nodes to execute on.
 */
private Collection<ClusterNode> nodes() throws IgniteCheckedException {
  CacheMode cacheMode = cctx.config().getCacheMode();
  Integer part = partition();
  switch (cacheMode) {
    case LOCAL:
      if (prj != null)
        U.warn(log, "Ignoring query projection because it's executed over LOCAL cache " +
          "(only local node will be queried): " + this);
      if (type == SCAN && cctx.config().getCacheMode() == LOCAL &&
        part != null && part >= cctx.affinity().partitions())
        throw new IgniteCheckedException("Invalid partition number: " + part);
      return Collections.singletonList(cctx.localNode());
    case REPLICATED:
      if (prj != null || part != null)
        return nodes(cctx, prj, part);
      if (cctx.affinityNode())
        return Collections.singletonList(cctx.localNode());
      Collection<ClusterNode> affNodes = nodes(cctx, null, null);
      return affNodes.isEmpty() ? affNodes : Collections.singletonList(F.rand(affNodes));
    case PARTITIONED:
      return nodes(cctx, prj, part);
    default:
      throw new IllegalStateException("Unknown cache distribution mode: " + cacheMode);
  }
}

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

nodes = singletonList(locNode);
else
  nodes = singletonList(F.rand(nodes));

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

ClusterNode n = pl.size() == 1 ? F.first(pl) : F.rand(pl);

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

nodes = singletonList(F.rand(nodes));
ClusterNode node = F.rand(nodes);

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

keys.add(i);
Ignite g = F.rand(ignites);

代码示例来源:origin: org.apache.ignite/ignite-core

/** {@inheritDoc} */
@Override public final ClusterGroup forRandom() {
  if (!F.isEmpty(ids))
    return forNodeId(F.rand(ids));
  Collection<ClusterNode> nodes = nodes();
  if (nodes.isEmpty())
    return new ClusterGroupAdapter(ctx, null, Collections.<UUID>emptySet());
  return forNode(F.rand(nodes));
}

代码示例来源:origin: org.apache.ignite/ignite-core

/**
 * @return Nodes to execute on.
 */
private Collection<ClusterNode> nodes() throws IgniteCheckedException {
  CacheMode cacheMode = cctx.config().getCacheMode();
  Integer part = partition();
  switch (cacheMode) {
    case LOCAL:
      if (prj != null)
        U.warn(log, "Ignoring query projection because it's executed over LOCAL cache " +
          "(only local node will be queried): " + this);
      if (type == SCAN && cctx.config().getCacheMode() == LOCAL &&
        part != null && part >= cctx.affinity().partitions())
        throw new IgniteCheckedException("Invalid partition number: " + part);
      return Collections.singletonList(cctx.localNode());
    case REPLICATED:
      if (prj != null || part != null)
        return nodes(cctx, prj, part);
      if (cctx.affinityNode())
        return Collections.singletonList(cctx.localNode());
      Collection<ClusterNode> affNodes = nodes(cctx, null, null);
      return affNodes.isEmpty() ? affNodes : Collections.singletonList(F.rand(affNodes));
    case PARTITIONED:
      return nodes(cctx, prj, part);
    default:
      throw new IllegalStateException("Unknown cache distribution mode: " + cacheMode);
  }
}

代码示例来源:origin: org.apache.ignite/ignite-indexing

nodes = singletonList(locNode);
else
  nodes = singletonList(F.rand(nodes));

代码示例来源:origin: org.apache.ignite/ignite-indexing

ClusterNode n = pl.size() == 1 ? F.first(pl) : F.rand(pl);

代码示例来源:origin: org.apache.ignite/ignite-indexing

nodes = singletonList(F.rand(nodes));
ClusterNode node = F.rand(nodes);

相关文章