/** @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());
  }
  /** @param cnt Count. */
  private void checkRemove(int cnt) {
    init();

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

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

    assertEquals(cnt, lru.size());

    for (long addr : set) lru.remove(addr);

    assertEquals(0, lru.size());
  }
  /** @param cnt Count. */
  private void checkOffer(int cnt) {
    init();

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

    assertEquals(cnt, lru.size());

    info("Finished check offer for stripes count: " + stripes);
  }
  /** @throws Exception If failed. */
  private void checkLruMultithreaded(final int cnt) throws Exception {
    init();

    final AtomicInteger idGen = new AtomicInteger();

    multithreaded(
        new Runnable() {
          @Override
          public void run() {
            int id = idGen.getAndIncrement();

            int step = 10;

            assert cnt % step == 0;

            int start = id * cnt;
            int end = start + cnt;

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

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

            for (int i = start; i < end; 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();
            }
          }
        },
        10);

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