/** clear removes all elements */
 public void testClear() {
   DelayQueue q = populatedQueue(SIZE);
   q.clear();
   assertTrue(q.isEmpty());
   assertEquals(0, q.size());
   assertEquals(Integer.MAX_VALUE, q.remainingCapacity());
   PDelay x = new PDelay(1);
   q.add(x);
   assertFalse(q.isEmpty());
   assertTrue(q.contains(x));
   q.clear();
   assertTrue(q.isEmpty());
 }
 public void shutdown() {
   if (null != executorService) {
     executorService.shutdown();
   }
   if (null != taskQueue) {
     taskQueue.clear();
   }
 }
Exemple #3
0
 /**
  * Shut down this Leases instance. All pending leases will be destroyed, without any cancellation
  * calls.
  */
 public void close() {
   LOG.info(Thread.currentThread().getName() + " closing leases");
   this.stopRequested = true;
   synchronized (leaseQueue) {
     leaseQueue.clear();
     leases.clear();
     leaseQueue.notifyAll();
   }
   LOG.info(Thread.currentThread().getName() + " closed leases");
 }