org.eclipse.rdf4j.federated.evaluation.join

## Class ControlledWorkerLeftJoin

- 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.ControlledWorkerLeftJoin

- All Implemented Interfaces:
    AutoCloseable, Runnable, CloseableIteration<BindingSet,QueryEvaluationException>, Iteration<BindingSet,QueryEvaluationException>, ParallelExecutor<BindingSet>

      public class ControlledWorkerLeftJoin
      extends JoinExecutorBase<BindingSet>

  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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected LeftJoin` | `join`
    `protected Phaser` | `phaser`
    `protected ControlledWorkerScheduler<BindingSet>` | `scheduler`

    - ### Fields inherited from class org.eclipse.rdf4j.federated.evaluation.join.JoinExecutorBase

      `bindings, joinVars, leftIter, rightArg`

    - ### Fields inherited from class org.eclipse.rdf4j.federated.evaluation.concurrent.ParallelExecutorBase

      `closed, evaluationThread, executorId, finished, NEXT_EXECUTOR_ID, queryInfo, rightIter, rightQueue, strategy`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ControlledWorkerLeftJoin(ControlledWorkerScheduler<BindingSet> scheduler, FederationEvalStrategy strategy, CloseableIteration<BindingSet,QueryEvaluationException> leftIter, LeftJoin join, BindingSet bindings, QueryInfo queryInfo)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `done()` Inform the controlling instance that some job is done from a different thread.
    `protected void` | `handleBindings()` Implementations must implement this method to handle bindings.
    `void` | `toss(Exception e)` Toss some exception to the controlling instance

    - ### Methods inherited from class org.eclipse.rdf4j.federated.evaluation.join.JoinExecutorBase

      `getExecutorType, getJoinVars, handleClose, performExecution, setJoinVars`

    - ### 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.Iteration

      `stream`

- - ### Field Detail

    - #### scheduler

          protected final ControlledWorkerScheduler<BindingSet> scheduler

    - #### phaser

          protected final Phaser phaser

    - #### join

          protected final LeftJoin join

  - ### Constructor Detail

    - #### ControlledWorkerLeftJoin

          public ControlledWorkerLeftJoin(ControlledWorkerScheduler<BindingSet> scheduler,
                                          FederationEvalStrategy strategy,
                                          CloseableIteration<BindingSet,QueryEvaluationException> leftIter,
                                          LeftJoin join,
                                          BindingSet bindings,
                                          QueryInfo queryInfo)
                                   throws QueryEvaluationException

      Throws:
        `QueryEvaluationException`

  - ### Method Detail

    - #### handleBindings

          protected void handleBindings()
                                 throws Exception

      Description copied from class: `JoinExecutorBase`
      Implementations must implement this method to handle bindings. Use the following as a template `while (!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:
        `handleBindings` in class `JoinExecutorBase<BindingSet>`
      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 interface `ParallelExecutor<BindingSet>`
      Overrides:
        `done` in class `ParallelExecutorBase<BindingSet>`

    - #### toss

          public void toss(Exception e)

      Description copied from interface: `ParallelExecutor`
      Toss some exception to the controlling instance
      Specified by:
        `toss` in interface `ParallelExecutor<BindingSet>`
      Overrides:
        `toss` in class `ParallelExecutorBase<BindingSet>`

Copyright © 2015-2021 Eclipse Foundation. All Rights Reserved.