Class ControlledWorkerUnion<T>
- 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.union.UnionExecutorBase<T>
-
- org.eclipse.rdf4j.federated.evaluation.union.WorkerUnionBase<T>
-
- org.eclipse.rdf4j.federated.evaluation.union.ControlledWorkerUnion<T>
-
- All Implemented Interfaces:
AutoCloseable
,Runnable
,CloseableIteration<T,QueryEvaluationException>
,Iteration<T,QueryEvaluationException>
,ParallelExecutor<T>
public class ControlledWorkerUnion<T> extends WorkerUnionBase<T>
Execution of union tasks withControlledWorkerScheduler
. Tasks can be added using the provided functions. Note that the union operation is to be executed with theParallelExecutorBase.run()
method (also threaded execution is possible). Results are then contained in this iteration.- Author:
- Andreas Schwarte
-
-
Field Summary
Fields Modifier and Type Field Description static int
awakeCount
protected Phaser
phaser
protected ControlledWorkerScheduler<T>
scheduler
static int
waitingCount
-
Fields inherited from class org.eclipse.rdf4j.federated.evaluation.union.WorkerUnionBase
tasks
-
Fields inherited from class org.eclipse.rdf4j.federated.evaluation.concurrent.ParallelExecutorBase
evaluationThread, executorId, finished, log, NEXT_EXECUTOR_ID, queryInfo, rightIter, rightQueue, strategy
-
-
Constructor Summary
Constructors Constructor Description ControlledWorkerUnion(ControlledWorkerScheduler<T> scheduler, QueryInfo queryInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
done()
Inform the controlling instance that some job is done from a different thread.void
handleClose()
Called byAbstractCloseableIteration.close()
when it is called for the first time.void
toss(Exception e)
Toss some exception to the controlling instanceprotected void
union()
Note: this method must block until the union is executed completely.-
Methods inherited from class org.eclipse.rdf4j.federated.evaluation.union.WorkerUnionBase
addTask
-
Methods inherited from class org.eclipse.rdf4j.federated.evaluation.union.UnionExecutorBase
getExecutorType, performExecution
-
Methods inherited from class org.eclipse.rdf4j.federated.evaluation.concurrent.ParallelExecutorBase
addResult, checkTimeout, getDisplayId, getId, getNextElement, getQueryInfo, isFinished, run, toString
-
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, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.common.iteration.CloseableIteration
stream
-
-
-
-
Field Detail
-
waitingCount
public static int waitingCount
-
awakeCount
public static int awakeCount
-
scheduler
protected final ControlledWorkerScheduler<T> scheduler
-
phaser
protected final Phaser phaser
-
-
Constructor Detail
-
ControlledWorkerUnion
public ControlledWorkerUnion(ControlledWorkerScheduler<T> scheduler, QueryInfo queryInfo)
-
-
Method Detail
-
union
protected void union() throws Exception
Description copied from class:UnionExecutorBase
Note: 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:
union
in classUnionExecutorBase<T>
- Throws:
Exception
-
done
public void done()
Description copied from interface:ParallelExecutor
Inform the controlling instance that some job is done from a different thread. In most cases this is a no-op.- Specified by:
done
in interfaceParallelExecutor<T>
- Overrides:
done
in classParallelExecutorBase<T>
-
toss
public void toss(Exception e)
Description copied from interface:ParallelExecutor
Toss some exception to the controlling instance- Specified by:
toss
in interfaceParallelExecutor<T>
- Overrides:
toss
in classParallelExecutorBase<T>
-
handleClose
public void handleClose() throws QueryEvaluationException
Description copied from class:AbstractCloseableIteration
Called 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:
handleClose
in classWorkerUnionBase<T>
- Throws:
QueryEvaluationException
-
-