Class ControlledWorkerUnion<T>
java.lang.Object
org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration<T>
org.eclipse.rdf4j.common.iteration.LookAheadIteration<T>
org.eclipse.rdf4j.federated.evaluation.concurrent.ParallelExecutorBase<T>
org.eclipse.rdf4j.federated.evaluation.union.UnionExecutorBase<T>
org.eclipse.rdf4j.federated.evaluation.union.WorkerUnionBase<T>
org.eclipse.rdf4j.federated.evaluation.union.ControlledWorkerUnion<T>
- All Implemented Interfaces:
AutoCloseable, Runnable, Iterator<T>, CloseableIteration<T>, ParallelExecutor<T>
Execution of union tasks with
ControlledWorkerScheduler. Tasks can be added using the provided functions.
Note that the union operation is to be executed with the ParallelExecutorBase.run() method (also threaded execution is possible).
Results are then contained in this iteration.- Author:
- Andreas Schwarte
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intprotected final Phaserprotected final ControlledWorkerScheduler<T> static intFields inherited from class WorkerUnionBase
tasksFields inherited from class ParallelExecutorBase
evaluationThread, executorId, finished, log, NEXT_EXECUTOR_ID, queryInfo, rightIter, rightQueue, strategyModifier and TypeFieldDescriptionprotected Threadprotected final longprotected booleanprotected static final org.slf4j.Loggerprotected static final AtomicLongprotected final QueryInfoprotected CloseableIteration<T> protected FedXQueueCursor<T> protected final FederationEvalStrategyFields inherited from interface CloseableIteration
EMPTY_STATEMENT_ITERATION -
Constructor Summary
ConstructorsConstructorDescriptionControlledWorkerUnion(ControlledWorkerScheduler<T> scheduler, QueryInfo queryInfo) -
Method Summary
Modifier and TypeMethodDescriptionvoiddone()Inform the controlling instance that some job is done from a different thread.voidCalled byAbstractCloseableIteration.close()when it is called for the first time.voidToss some exception to the controlling instanceprotected voidunion()Note: this method must block until the union is executed completely.Methods inherited from class WorkerUnionBase
addTaskModifier and TypeMethodDescriptionvoidaddTask(ParallelTask<T> task) Add a generic parallel task.Methods inherited from class UnionExecutorBase
getExecutorType, performExecutionModifier and TypeMethodDescriptionprotected Stringprotected final voidPerform the parallel execution.Methods inherited from class ParallelExecutorBase
addResult, checkTimeout, getDisplayId, getId, getNextElement, getQueryInfo, isFinished, run, toStringModifier and TypeMethodDescriptionvoidaddResult(CloseableIteration<T> res) Handle the result appropriately, e.g. add it to the result iteration.protected voidChecks whether the query execution has run into a timeout.protected StringgetId()Gets the next element.Return the query info of the associated querybooleanReturn true if this executor is finished or abortedfinal voidrun()toString()Methods inherited from class LookAheadIteration
hasNext, next, removeModifier and TypeMethodDescriptionfinal booleanhasNext()final Tnext()voidremove()Throws anUnsupportedOperationException.Methods inherited from class AbstractCloseableIteration
close, isClosedModifier and TypeMethodDescriptionfinal voidclose()CallsAbstractCloseableIteration.handleClose()upon first call and makes sure the resource closures are only executed once.final booleanisClosed()Checks whether this CloseableIteration has been closed.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface CloseableIteration
streamMethods inherited from interface Iterator
forEachRemaining
-
Field Details
-
waitingCount
public static int waitingCount -
awakeCount
public static int awakeCount -
scheduler
-
phaser
-
-
Constructor Details
-
ControlledWorkerUnion
-
-
Method Details
-
union
Description copied from class:UnionExecutorBaseNote: this method must block until the union is executed completely. Otherwise the result queue is marked as committed while this isn't the case. The blocking behavior in general is no problem: If you need concurrent access to the result (i.e. pipelining) just run the union in a separate thread. Access to the result iteration is synchronized.- Specified by:
unionin classUnionExecutorBase<T>- Throws:
Exception
-
done
public void done()Description copied from interface:ParallelExecutorInform the controlling instance that some job is done from a different thread. In most cases this is a no-op.- Specified by:
donein interfaceParallelExecutor<T>- Overrides:
donein classParallelExecutorBase<T>
-
toss
Description copied from interface:ParallelExecutorToss some exception to the controlling instance- Specified by:
tossin interfaceParallelExecutor<T>- Overrides:
tossin classParallelExecutorBase<T>- Parameters:
e-
-
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 classWorkerUnionBase<T>- Throws:
QueryEvaluationException
-