Class FairBlockingQueue.FairIterator

java.lang.Object
org.apache.tomcat.jdbc.pool.FairBlockingQueue.FairIterator
All Implemented Interfaces:
Iterator<E>
Enclosing class:
FairBlockingQueue<E>

protected class FairBlockingQueue.FairIterator extends Object implements Iterator<E>
Iterator safe from concurrent modification exceptions. The iterator walks a snapshot of the queue contents taken when it was created, but remove() removes the last returned element - or, for element types with value semantics, an element equal to it - from the live queue. An element that was taken out of the queue and offered back as the same object between the snapshot and the removal is therefore also removed from the live queue - like the weakly consistent iterators of the JDK, this iterator makes no promise about seeing the current state of the queue.
  • Constructor Details

    • FairIterator

      public FairIterator()
      Creates a new FairIterator with a snapshot of the current queue contents.
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<E>
    • next

      public E next()
      Specified by:
      next in interface Iterator<E>
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<E>