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

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

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

F.eqNodes介绍

暂无

代码示例

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

/** {@inheritDoc} */
@Override public boolean equals(Object obj) {
  // NOTE!
  // Do not call super. As IDs will differ, but we can ignore this.
  if (!(obj instanceof TcpDiscoveryJoinRequestMessage))
    return false;
  TcpDiscoveryJoinRequestMessage other = (TcpDiscoveryJoinRequestMessage)obj;
  return F.eqNodes(other.node, node);
}

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

/** {@inheritDoc} */
@Override public boolean equals(Object obj) {
  return F.eqNodes(this, obj);
}

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

/** {@inheritDoc} */
@Override public boolean equals(Object o) {
  return F.eqNodes(this, o);
}

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

/** {@inheritDoc} */
@Override public boolean equals(Object o) {
  return F.eqNodes(this, o);
}

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

/** {@inheritDoc} */
@Override public boolean equals(Object obj) {
  // NOTE!
  // Do not call super. As IDs will differ, but we can ignore this.
  if (!(obj instanceof TcpDiscoveryStatusCheckMessage))
    return false;
  TcpDiscoveryStatusCheckMessage other = (TcpDiscoveryStatusCheckMessage)obj;
  return F.eqNodes(other.creatorNode, creatorNode) &&
    F.eq(other.failedNodeId, failedNodeId) &&
    status == other.status;
}

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

/** {@inheritDoc} */
@Override public boolean equals(Object o) {
  return F.eqNodes(this, o);
}

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

/**
   * @param disc Discovery.
   * @return Second node in the topology.
   * @throws InterruptedException If interrupted.
   */
  @SuppressWarnings("BusyWait")
  private ClusterNode awaitOther(final GridDiscoveryManager disc) throws InterruptedException {
    while (disc.allNodes().size() < 2)
      Thread.sleep(1000);
    for (ClusterNode node : disc.allNodes())
      if (!F.eqNodes(node, disc.localNode()))
        return node;
    assert false;
    return null;
  }
}

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

/**
 * JUnit.
 *
 * @throws Exception If failed.
 */
@Test
public void testMapPartitionsToNodeCollection() throws Exception {
  Collection<Integer> parts = new LinkedList<>();
  for (int p = 0; p < affinity().partitions(); p++)
    parts.add(p);
  Map<Integer, ClusterNode> map = grid(0).affinity(DEFAULT_CACHE_NAME).mapPartitionsToNodes(parts);
  AffinityFunctionContext ctx =
    new GridAffinityFunctionContextImpl(new ArrayList<>(grid(0).cluster().nodes()), null, null,
      new AffinityTopologyVersion(1), 1);
  AffinityFunction aff = affinity();
  List<List<ClusterNode>> assignment = aff.assignPartitions(ctx);
  for (Map.Entry<Integer, ClusterNode> e : map.entrySet())
    assert F.eqNodes(F.first(nodes(assignment, aff, e.getKey())), e.getValue());
}

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

/**
 * JUnit.
 *
 * @throws Exception If failed.
 */
@Test
public void testMapPartitionsToNode() throws Exception {
  Map<Integer, ClusterNode> map = grid(0).affinity(DEFAULT_CACHE_NAME).mapPartitionsToNodes(F.asList(0, 1, 5, 19, 12));
  AffinityFunctionContext ctx =
    new GridAffinityFunctionContextImpl(new ArrayList<>(grid(0).cluster().nodes()), null, null,
      new AffinityTopologyVersion(1), 1);
  AffinityFunction aff = affinity();
  List<List<ClusterNode>> assignment = aff.assignPartitions(ctx);
  for (Map.Entry<Integer, ClusterNode> e : map.entrySet())
    assert F.eqNodes(F.first(nodes(assignment, aff, e.getKey())), e.getValue());
}

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

/**
 * JUnit.
 *
 * @throws Exception If failed.
 */
@Test
public void testMapPartitionsToNodeArray() throws Exception {
  Map<Integer, ClusterNode> map = grid(0).affinity(DEFAULT_CACHE_NAME).mapPartitionsToNodes(F.asList(0, 1, 5, 19, 12));
  AffinityFunctionContext ctx =
    new GridAffinityFunctionContextImpl(new ArrayList<>(grid(0).cluster().nodes()), null, null,
      new AffinityTopologyVersion(1), 1);
  AffinityFunction aff = affinity();
  List<List<ClusterNode>> assignment = aff.assignPartitions(ctx);
  for (Map.Entry<Integer, ClusterNode> e : map.entrySet())
    assert F.eqNodes(F.first(nodes(assignment, aff, e.getKey())), e.getValue());
}

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

/**
   * @param key Key.
   * @return For the given key pair {primary node, some other node}.
   */
  private IgniteBiTuple<ClusterNode, ClusterNode> getNodes(Integer key) {
    Affinity<Integer> aff = grid(0).affinity(DEFAULT_CACHE_NAME);

    int part = aff.partition(key);

    ClusterNode primary = aff.mapPartitionToNode(part);

    assert primary != null;

    Collection<ClusterNode> nodes = new ArrayList<>(grid(0).cluster().nodes());

    nodes.remove(primary);

    ClusterNode other = F.first(nodes);

    assert other != null;

    assert !F.eqNodes(primary, other);

    return F.t(primary, other);
  }
}

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

/**
 * JUnit.
 *
 * @throws Exception If failed.
 */
@Test
public void testPrimaryPartitions() throws Exception {
  // Pick 2 nodes and create a projection over them.
  ClusterNode n0 = grid(0).localNode();
  int[] parts = grid(0).affinity(DEFAULT_CACHE_NAME).primaryPartitions(n0);
  info("Primary partitions count: " + parts.length);
  assert parts.length > 1 : "Invalid partitions: " + Arrays.toString(parts);
  for (int part : parts)
    assert part >= 0;
  assert !F.isEmpty(parts);
  AffinityFunctionContext ctx =
    new GridAffinityFunctionContextImpl(new ArrayList<>(grid(0).cluster().nodes()), null, null,
      new AffinityTopologyVersion(1), 1);
  List<List<ClusterNode>> assignment = affinity().assignPartitions(ctx);
  for (int p : parts) {
    Collection<ClusterNode> owners = nodes(assignment, p);
    assert !F.isEmpty(owners);
    ClusterNode primary = F.first(owners);
    assert F.eqNodes(n0, primary);
  }
}

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

/**
 * JUnit.
 *
 * @throws Exception If failed.
 */
@Test
public void testPrimaryPartitionsOneNode() throws Exception {
  AffinityFunctionContext ctx =
    new GridAffinityFunctionContextImpl(new ArrayList<>(grid(0).cluster().nodes()), null, null,
      new AffinityTopologyVersion(1), 1);
  List<List<ClusterNode>> assignment = affinity().assignPartitions(ctx);
  for (ClusterNode node : grid(0).cluster().nodes()) {
    int[] parts = grid(0).affinity(DEFAULT_CACHE_NAME).primaryPartitions(node);
    assert !F.isEmpty(parts);
    for (int p : parts) {
      Collection<ClusterNode> owners = nodes(assignment, p);
      assert !F.isEmpty(owners);
      ClusterNode primary = F.first(owners);
      assert F.eqNodes(node, primary);
    }
  }
}

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

assert !F.eqNodes(primary, backup);
assert !F.eqNodes(primary, other);
assert !F.eqNodes(backup, other);

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

F.eqNodes(grid(0).localNode(), aff.mapKeyToNode(key)) + ']');
F.eqNodes(grid(1).localNode(), aff.mapKeyToNode(key)) + ']');

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

assert F.eqNodes(localNode(), node);

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

/** {@inheritDoc} */
@Override public boolean equals(Object o) {
  return F.eqNodes(this, o);
}

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

/** {@inheritDoc} */
@Override public boolean equals(Object obj) {
  // NOTE!
  // Do not call super. As IDs will differ, but we can ignore this.
  if (!(obj instanceof TcpDiscoveryJoinRequestMessage))
    return false;
  TcpDiscoveryJoinRequestMessage other = (TcpDiscoveryJoinRequestMessage)obj;
  return F.eqNodes(other.node, node);
}

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

/** {@inheritDoc} */
@Override public boolean equals(Object obj) {
  // NOTE!
  // Do not call super. As IDs will differ, but we can ignore this.
  if (!(obj instanceof TcpDiscoveryStatusCheckMessage))
    return false;
  TcpDiscoveryStatusCheckMessage other = (TcpDiscoveryStatusCheckMessage)obj;
  return F.eqNodes(other.creatorNode, creatorNode) &&
    F.eq(other.failedNodeId, failedNodeId) &&
    status == other.status;
}

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

assert F.eqNodes(localNode(), node);

相关文章