Class AbstractCloseableIteration<E>
- java.lang.Object
-
- org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration<E>
-
- All Implemented Interfaces:
AutoCloseable
,Iterator<E>
,CloseableIteration<E>
- Direct Known Subclasses:
AbstractCloseableIteratorIteration
,CloseDependentConnectionIteration
,CollectionIteration
,ConvertingIteration
,DelayedIteration
,ExceptionConvertingIteration
,GraphToBindingSetConversionIteration
,IterationWrapper
,LookAheadIteration
,PrintingIteration
,QueryContextIteration
,QueryResultIteration
,RepositoryResult
,SingleBindingSetIteration
,SingletonIteration
,StatementConversionIteration
,StopRemainingExecutionsOnCloseIteration
,ThreadSafeDelayedIteration
public abstract class AbstractCloseableIteration<E> extends Object implements CloseableIteration<E>
Base class forCloseableIteration
s offering common functionality. This class keeps track of whether the iteration has been closed and handles multiple calls toclose()
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 Summary
Constructors Constructor Description AbstractCloseableIteration()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
CallshandleClose()
upon first call and makes sure the resource closures are only executed once.protected abstract void
handleClose()
Called byclose()
when it is called for the first time.boolean
isClosed()
Checks whether this CloseableIteration has been closed.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.common.iteration.CloseableIteration
stream
-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
-
-
-
Method Detail
-
isClosed
public final boolean isClosed()
Checks whether this CloseableIteration has been closed.- Returns:
- true if the CloseableIteration has been closed, false otherwise.
-
close
public final void close()
CallshandleClose()
upon first call and makes sure the resource closures are only executed once.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseableIteration<E>
-
handleClose
protected abstract void handleClose()
Called byclose()
when it is called for the first time. This method is only called once on each iteration. By default, this method does nothing.
-
-