コード例 #1
0
  /** Cleans up resources to avoid excessive memory usage. */
  public void cleanUp() {
    topSnapshot.set(null);
    singleMsgs.clear();
    fullMsgs.clear();
    rcvdIds.clear();
    oldestNode.set(null);
    partReleaseFut = null;

    Collection<ClusterNode> rmtNodes = this.rmtNodes;

    if (rmtNodes != null) rmtNodes.clear();
  }
コード例 #2
0
  /** @param cnt Count. */
  private void checkPoll(int cnt) {
    init();

    int step = 10;

    assert cnt % step == 0;

    Collection<Long> set = new HashSet<>(step);

    for (int i = 0; i < cnt; i++) lru.offer(0, i, i);

    assertEquals(cnt, lru.size());

    for (int i = 0; i < cnt; i += step) {
      for (int j = 0; j < step; j++) {
        long qAddr = lru.prePoll();

        assertTrue(qAddr != 0);
        assertTrue(set.add(qAddr));
      }

      for (long qAddr : set) lru.poll(qAddr);

      set.clear();
    }

    assertEquals(0, lru.size());
  }