Interface CloseableIteration<E,X extends Exception>

All Superinterfaces:
AutoCloseable, Iteration<E,X>
All Known Subinterfaces:
GraphQueryResult, QueryResult<T>, TupleQueryResult
All Known Implementing Classes:
AbstractCloseableIteration, AbstractParserQuery.QueryInterruptIteration, AbstractParserQuery.QueryInterruptIteration, BackgroundGraphResult, BackgroundTupleResult, BadlyDesignedLeftJoinIterator, BottomUpJoinIterator, BoundJoinConversionIteration, BoundJoinVALUESConversionIteration, CachedGraphQueryResult, CachedTupleQueryResult, CloseableIteratorIteration, CloseablePeakableIteration, CloseDependentConnectionIteration, CollectionIteration, CollectionIteration, CompatibleBindingSetFilter, ConsumingIteration, ControlledWorkerBoundJoin, ControlledWorkerJoin, ControlledWorkerLeftJoin, ControlledWorkerUnion, ConvertingIteration, CrossProductIteration, DelayedEvaluationIteration, DelayedIteration, DescribeIteration, DistinctIteration, DistinctModelReducingUnionIteration, DualUnionIteration, EmptyIteration, ExceptionConvertingIteration, ExtensionIterator, FederatedDescribeIteration, FedXQueueCursor, FilteringInsertBindingsIteration, FilteringIteration, FilteringIteration, FilterIteration, FilterIterator, GraphQueryResultImpl, GraphToBindingSetConversionIteration, GroupedCheckConversionIteration, GroupIterator, HashJoin, HashJoinIteration, IndependentJoingroupBindingsIteration, IndependentJoingroupBindingsIteration2, IndependentJoingroupBindingsIteration3, InsertBindingSetCursor, InsertBindingsIteration, IntersectIteration, IteratingGraphQueryResult, IteratingTupleQueryResult, IterationWrapper, JoinExecutorBase, JoinExecutorBase, JoinExecutorBase, JoinIterator, LazyMutableClosableIteration, LeftJoinIterator, LimitedSizeDistinctIteration, LimitIteration, LockingIteration, LoggingCloseableIteration, LookAheadIteration, MemStatementIterator, MemTripleIterator, MinusIteration, MultiProjectionIterator, MutableTupleQueryResult, OffsetIteration, OrderIterator, ParallelExecutorBase, ParallelServiceExecutor, PathIteration, PrintingIteration, ProjectionIterator, QueryContextIteration, QueryEvaluationStep.DelayedEvaluationIteration, QueryResultIteration, QueueCursor, QueueIteration, ReducedIteration, RepositoryExceptionConvertingIteration, RepositoryResult, ReusableGraphQueryResult, ReusableTupleQueryResult, ServiceCrossProductIteration, ServiceJoinConversionIteration, ServiceJoinConversionIteration, ServiceJoinIterator, SilentIteration, SilentIteration, SingleBindingSetIteration, SingletonIteration, SPARQLCrossProductIteration, SPARQLMinusIteration, StatementConversionIteration, StopRemainingExecutionsOnCloseIteration, SynchronousBoundJoin, SynchronousJoin, SynchronousWorkerUnion, TimeLimitIteration, TripleSourceIterationWrapper, TupleQueryResultImpl, UnionExecutorBase, UnionIteration, WorkerUnionBase, ZeroLengthPathIteration

@Deprecated(since="4.1.0") public interface CloseableIteration<E,X extends Exception> extends Iteration<E,X>, AutoCloseable
Deprecated.
In the future this interface will stop extending Iteration and instead declare the same interface methods directly. The interface will also stop requiring implementations to automatically close when exhausted, instead making this an optional feature and requiring the user to always call close. This interface may also be removed.
An Iteration that can be closed to free resources that it is holding. CloseableIterations automatically free their resources when exhausted. If not read until exhaustion or if you want to make sure the iteration is properly closed, any code using the iterator should be placed in a try-with-resources block, closing the iteration automatically, e.g.:

 try (CloseableIteration<Object, Exception> iter = ...) {
    // read objects from the iterator
 }
 catch(Exception e) {
   // process the exception that can be thrown while processing.
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated.
    Closes this iteration, freeing any resources that it is holding.
    default Stream<E>
    Deprecated.
    Convert the results to a Java 8 Stream.

    Methods inherited from interface org.eclipse.rdf4j.common.iteration.Iteration

    hasNext, next, remove
  • Method Details

    • stream

      default Stream<E> stream()
      Deprecated.
      Convert the results to a Java 8 Stream.
      Specified by:
      stream in interface Iteration<E,X extends Exception>
      Returns:
      stream
    • close

      void close() throws X
      Deprecated.
      Closes this iteration, freeing any resources that it is holding. If the iteration has already been closed then invoking this method has no effect.
      Specified by:
      close in interface AutoCloseable
      Throws:
      X extends Exception