Пример #1
0
 public Object call() throws Exception {
   _barrier.await(); // barrier, to force racing start
   for (long j = 0; j < _count; j++)
     _map.put(
         j + _offset,
         new TestKey(_rand.nextLong(), _rand.nextInt(), (short) _rand.nextInt(Short.MAX_VALUE)));
   return null;
 }
Пример #2
0
  /** Test that new records can be continuously added without hitting {@link OutOfMemoryError}. */
  @Test
  @Ignore("Start this test with a small heap size (e.g. -Xmx64m)")
  public void testPerformance() {
    final Random random = new Random(System.nanoTime());

    while (true) {
      final byte[] key = new byte[100];
      random.nextBytes(key);
      final int size = random.nextInt();
      final long pointer = random.nextLong();

      cache.add(key, size, pointer);
    }
  }