Esempio n. 1
0
 @After
 public void cleanup() throws IOException {
   if (reuseQueue) {
     queue.clear();
   } else {
     queue.dispose();
   }
 }
Esempio n. 2
0
  private void test(int numInList) throws IOException {
    for (int i = 0; i < numInList; i++) {
      queue.add(i);
    }

    Iterator<Integer> it = queue.reread().iterator();
    for (int i = 0; i < numInList; i++) {
      assertEquals(new Integer(i), it.next());
    }
  }
Esempio n. 3
0
  @Test
  public void testMultipleCycles() throws IOException {
    for (int i = 0; i < 10; i++) {
      // also test reading increasingly short lists back in
      test(maxObjectsInMemory * 2 * (10 - i));
      queue.clear();

      // garbage collection can trigger finalizers,
      // which in turn close file descriptors
      System.gc();
    }
  }
Esempio n. 4
0
 @AfterClass
 public static void cleanupClass() throws IOException {
   if (queue != null) {
     queue.dispose();
   }
 }