Class JoinExecutorBase<T>
- java.lang.Object
-
- org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration<E>
-
- org.eclipse.rdf4j.common.iteration.LookAheadIteration<T>
-
- org.eclipse.rdf4j.repository.sparql.federation.JoinExecutorBase<T>
-
- All Implemented Interfaces:
AutoCloseable,Iterator<T>,CloseableIteration<T>
- Direct Known Subclasses:
ServiceJoinIterator
public abstract class JoinExecutorBase<T> extends LookAheadIteration<T>
Base class for any join parallel join executor. Note that this class extendsLookAheadIterationand thus any implementation of this class is applicable for pipelining when used in a different thread (access to shared variables is synchronized).- Author:
- Andreas Schwarte
-
-
Field Summary
Fields Modifier and Type Field Description protected BindingSetbindingsprotected booleanclosedDeprecated.UseAbstractCloseableIteration.isClosed()instead.protected booleanfinishedDeprecated.UseisFinished()instead.protected CloseableIteration<T>leftIterprotected static intNEXT_JOIN_IDDeprecated.No replacement, don't use static shared int variables.protected TupleExprrightArgprotected CloseableIteration<T>rightIterprotected QueueCursor<CloseableIteration<T>>rightQueue
-
Constructor Summary
Constructors Modifier Constructor Description protectedJoinExecutorBase(CloseableIteration<T> leftIter, TupleExpr rightArg, BindingSet bindings)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddResult(CloseableIteration<T> res)voiddone()TgetNextElement()Gets the next element.protected abstract voidhandleBindings()Implementations must implement this method to handle bindings.voidhandleClose()Called byAbstractCloseableIteration.close()when it is called for the first time.booleanisFinished()Gets whether this executor is finished or aborted.voidrun()voidtoss(Exception e)-
Methods inherited from class org.eclipse.rdf4j.common.iteration.LookAheadIteration
hasNext, next, remove
-
Methods inherited from class org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration
close, isClosed
-
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
-
-
-
-
Field Detail
-
NEXT_JOIN_ID
protected static int NEXT_JOIN_ID
Deprecated.No replacement, don't use static shared int variables.
-
rightArg
protected final TupleExpr rightArg
-
bindings
protected final BindingSet bindings
-
leftIter
protected final CloseableIteration<T> leftIter
-
rightIter
protected volatile CloseableIteration<T> rightIter
-
closed
protected volatile boolean closed
Deprecated.UseAbstractCloseableIteration.isClosed()instead.
-
finished
protected volatile boolean finished
Deprecated.UseisFinished()instead.
-
rightQueue
protected final QueueCursor<CloseableIteration<T>> rightQueue
-
-
Constructor Detail
-
JoinExecutorBase
protected JoinExecutorBase(CloseableIteration<T> leftIter, TupleExpr rightArg, BindingSet bindings) throws QueryEvaluationException
- Throws:
QueryEvaluationException
-
-
Method Detail
-
run
public final void run()
-
handleBindings
protected abstract void handleBindings() throws ExceptionImplementations must implement this method to handle bindings. Use the following as a templatewhile (!closed && leftIter.hasNext()) { // your code }and add results to rightQueue. Note that addResult() is implemented synchronized and thus thread safe. In case you can guarantee sequential access, it is also possible to directly access rightQueue- Throws:
Exception
-
addResult
public void addResult(CloseableIteration<T> res)
-
done
public void done()
-
toss
public void toss(Exception e)
-
getNextElement
public T getNextElement() throws QueryEvaluationException
Description copied from class:LookAheadIterationGets the next element. Subclasses should implement this method so that it returns the next element.- Specified by:
getNextElementin classLookAheadIteration<T>- Returns:
- The next element, or null if no more elements are available.
- Throws:
QueryEvaluationException
-
handleClose
public void handleClose() throws QueryEvaluationExceptionDescription copied from class:AbstractCloseableIterationCalled byAbstractCloseableIteration.close()when it is called for the first time. This method is only called once on each iteration. By default, this method does nothing.- Specified by:
handleClosein classAbstractCloseableIteration<T>- Throws:
QueryEvaluationException
-
isFinished
public boolean isFinished()
Gets whether this executor is finished or aborted.- Returns:
- true if this executor is finished or aborted
-
-