Package org.eclipse.rdf4j.federated.evaluation.join

## Class JoinExecutorBase<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.join.JoinExecutorBase<T>

- All Implemented Interfaces:
    `AutoCloseable`, `Runnable`, `CloseableIteration<T,​QueryEvaluationException>`, `Iteration<T,​QueryEvaluationException>`, `ParallelExecutor<T>`
  Direct Known Subclasses:
    `ControlledWorkerJoin`, `ControlledWorkerLeftJoin`, `HashJoin`, `SynchronousJoin`

      public abstract class JoinExecutorBase<T>
      extends ParallelExecutorBase<T>

  Base class for any join parallel join executor. Note that this class extends `LookAheadIteration` and 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 BindingSet` | `bindings` |
    `protected Set<String>` | `joinVars` |
    `protected CloseableIteration<T,​QueryEvaluationException>` | `leftIter` |
    `protected TupleExpr` | `rightArg` |

    - ### 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
    --- | ---
    `JoinExecutorBase​(FederationEvalStrategy strategy, CloseableIteration<T,​QueryEvaluationException> leftIter, TupleExpr rightArg, BindingSet bindings, QueryInfo queryInfo)` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected String` | `getExecutorType()` |
    `Set<String>` | `getJoinVars()` |
    `protected abstract void` | `handleBindings()` | Implementations must implement this method to handle bindings.
    `void` | `handleClose()` | Called by `AbstractCloseableIteration.close()` when it is called for the first time.
    `protected void` | `performExecution()` | Perform the parallel execution.
    `void` | `setJoinVars​(Set<String> joinVars)` | Set the join variables

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

      `addResult, checkTimeout, done, getDisplayId, getId, getNextElement, getQueryInfo, isFinished, run, toss, 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

    - #### rightArg

          protected final TupleExpr rightArg

    - #### bindings

          protected final BindingSet bindings

    - #### joinVars

          protected Set<String> joinVars

    - #### leftIter

          protected CloseableIteration<T,​QueryEvaluationException> leftIter

  - ### Constructor Detail

    - #### JoinExecutorBase

          public JoinExecutorBase​(FederationEvalStrategy strategy,
                                  CloseableIteration<T,​QueryEvaluationException> leftIter,
                                  TupleExpr rightArg,
                                  BindingSet bindings,
                                  QueryInfo queryInfo)
                           throws QueryEvaluationException

      Throws:
        `QueryEvaluationException`

  - ### Method Detail

    - #### performExecution

          protected final void performExecution()
                                         throws Exception

      Description copied from class: `ParallelExecutorBase`
      Perform the parallel execution. Note that this method must block until the execution is completed.
      Specified by:
        `performExecution` in class `ParallelExecutorBase<T>`
      Throws:
        `Exception`

    - #### handleBindings

          protected abstract void handleBindings()
                                          throws Exception

      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.
      Throws:
        `Exception`

    - #### handleClose

          public void handleClose()
                           throws QueryEvaluationException

      Description copied from class: `AbstractCloseableIteration`
      Called by `AbstractCloseableIteration.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 class `ParallelExecutorBase<T>`
      Throws:
        `QueryEvaluationException`

    - #### getExecutorType

          protected String getExecutorType()

      Overrides:
        `getExecutorType` in class `ParallelExecutorBase<T>`
      Returns:
        the executor type, e.g. "Join". Default "Executor"

    - #### getJoinVars

          public Set<String> getJoinVars()

      Returns:
        the join variables, might be `null` if unknown in the concrete implementation

    - #### setJoinVars

          public void setJoinVars​(Set<String> joinVars)

      Set the join variables
      Parameters:
        `joinVars` - the join variables