Class ControlledWorkerJoin
java.lang.Object
org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration<E,X>
org.eclipse.rdf4j.common.iteration.LookAheadIteration<T,QueryEvaluationException>
org.eclipse.rdf4j.federated.evaluation.concurrent.ParallelExecutorBase<T>
org.eclipse.rdf4j.federated.evaluation.join.JoinExecutorBase<BindingSet>
org.eclipse.rdf4j.federated.evaluation.join.ControlledWorkerJoin
- All Implemented Interfaces:
AutoCloseable,Runnable,CloseableIteration<BindingSet,,QueryEvaluationException> Iteration<BindingSet,,QueryEvaluationException> ParallelExecutor<BindingSet>
- Direct Known Subclasses:
ControlledWorkerBoundJoin
Execute the nested loop join in an asynchronous fashion, i.e. one binding after the other (but concurrently)
The number of concurrent threads is controlled by a
ControlledWorkerScheduler which works according to the
FIFO principle.
This join cursor blocks until all scheduled tasks are finished, however the result iteration can be accessed from
different threads to allow for pipelining.- Author:
- Andreas Schwarte
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Phaserprotected final ControlledWorkerScheduler<BindingSet>Fields inherited from class org.eclipse.rdf4j.federated.evaluation.join.JoinExecutorBase
bindings, joinVars, leftIter, rightArgFields inherited from class org.eclipse.rdf4j.federated.evaluation.concurrent.ParallelExecutorBase
evaluationThread, executorId, finished, NEXT_EXECUTOR_ID, queryInfo, rightIter, rightQueue, strategy -
Constructor Summary
ConstructorsConstructorDescriptionControlledWorkerJoin(ControlledWorkerScheduler<BindingSet> scheduler, FederationEvalStrategy strategy, CloseableIteration<BindingSet, QueryEvaluationException> leftIter, TupleExpr rightArg, BindingSet bindings, QueryInfo queryInfo) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidImplementations must implement this method to handle bindings.voidCalled byAbstractCloseableIteration.close()when it is called for the first time.Methods inherited from class org.eclipse.rdf4j.federated.evaluation.join.JoinExecutorBase
getExecutorType, getJoinVars, performExecution, setJoinVarsMethods inherited from class org.eclipse.rdf4j.federated.evaluation.concurrent.ParallelExecutorBase
addResult, checkTimeout, done, getDisplayId, getId, getNextElement, getQueryInfo, isFinished, run, toss, toStringMethods inherited from class org.eclipse.rdf4j.common.iteration.LookAheadIteration
hasNext, next, removeMethods inherited from class org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration
close, isClosedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.rdf4j.common.iteration.CloseableIteration
stream
-
Field Details
-
scheduler
-
phaser
-
-
Constructor Details
-
ControlledWorkerJoin
public ControlledWorkerJoin(ControlledWorkerScheduler<BindingSet> scheduler, FederationEvalStrategy strategy, CloseableIteration<BindingSet, QueryEvaluationException> leftIter, TupleExpr rightArg, BindingSet bindings, QueryInfo queryInfo) throws QueryEvaluationException- Throws:
QueryEvaluationException
-
-
Method Details
-
handleBindings
Description copied from class:JoinExecutorBaseImplementations 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 Note that the implementation must block until the entire join is executed.- Specified by:
handleBindingsin classJoinExecutorBase<BindingSet>- Throws:
Exception
-
handleClose
Description 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.- Overrides:
handleClosein classJoinExecutorBase<BindingSet>- Throws:
QueryEvaluationException
-