Interface SafeIterator<E>

All Superinterfaces:
Iterator<E>

public interface SafeIterator<E> extends Iterator<E>
A concurrency-safe iterator that iterates over events representing statement results (pull API) in the face of concurrent event processing by further threads.

In comparison to the regular iterator, the safe iterator guarantees correct results even as events are being processed by other threads. The cost is that the iterator holds one or more locks that must be released via the close method. Any locks are acquired at the time an instance is created.

NOTE: An application MUST explicitly close the safe iterator instance using the close method, to release locks held by the iterator. The call to the close method should be done in a finally block to make sure the iterator gets closed.

Multiple safe iterators may be not be used at the same time by different application threads. A single application thread may hold and use multiple safe iterators however this is discouraged.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Close the safe itertor, releasing locks.

    Methods inherited from interface java.util.Iterator

    forEachRemaining, hasNext, next, remove
  • Method Details

    • close

      void close()
      Close the safe itertor, releasing locks. This is a required call and should preferably occur in a finally block.