Class AbstractCloseableIteration<E,X extends Exception>

All Implemented Interfaces:
AutoCloseable, CloseableIteration<E,X>, Iteration<E,X>
Direct Known Subclasses:
CloseableIteratorIteration, CloseDependentConnectionIteration, CollectionIteration, ConvertingIteration, DelayedIteration, EmptyIteration, ExceptionConvertingIteration, GraphToBindingSetConversionIteration, IterationWrapper, LookAheadIteration, PrintingIteration, QueryContextIteration, QueryResultIteration, RepositoryResult, SingleBindingSetIteration, SingletonIteration, StatementConversionIteration, StopRemainingExecutionsOnCloseIteration

public abstract class AbstractCloseableIteration<E,X extends Exception> extends Object implements CloseableIteration<E,X>
Base class for CloseableIterations offering common functionality. This class keeps track of whether the iteration has been closed and handles multiple calls to close() by ignoring all but the first call. Instances of this class is not safe to be accessed from multiple threads at the same time.
  • Constructor Details

    • AbstractCloseableIteration

      public AbstractCloseableIteration()
  • Method Details

    • isClosed

      public final boolean isClosed()
      Checks whether this CloseableIteration has been closed.
      true if the CloseableIteration has been closed, false otherwise.
    • close

      public final void close() throws X
      Calls handleClose() upon first call and makes sure the resource closures are only executed once.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface CloseableIteration<E,X extends Exception>
      X extends Exception
    • handleClose

      protected void handleClose() throws X
      Called by close() when it is called for the first time. This method is only called once on each iteration. By default, this method does nothing.