Package org.eclipse.rdf4j.federated.optimizer

## Class SourceSelection.SourceSelectionExecutorWithLatch

- java.lang.Object
- - org.eclipse.rdf4j.federated.optimizer.SourceSelection.SourceSelectionExecutorWithLatch

- All Implemented Interfaces:
    `Runnable`, `ParallelExecutor<BindingSet>`
  Enclosing class:
    SourceSelection

      protected static class SourceSelection.SourceSelectionExecutorWithLatch
      extends Object
      implements ParallelExecutor<BindingSet>

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected List<Exception>` | `errors` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addResult​(CloseableIteration<BindingSet,​QueryEvaluationException> res)` | Handle the result appropriately, e.g.
    `void` | `done()` | Inform the controlling instance that some job is done from a different thread.
    `QueryInfo` | `getQueryInfo()` | Return the query info of the associated query
    `boolean` | `isFinished()` | Return true if this executor is finished or aborted
    `void` | `run()` |
    `static void` | `run​(SourceSelection sourceSelection, List<SourceSelection.CheckTaskPair> tasks, SourceSelectionCache cache)` | Execute the given list of tasks in parallel, and block the thread until all tasks are completed.
    `void` | `toss​(Exception e)` | Toss some exception to the controlling instance

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### errors

          protected List<Exception> errors

  - ### Method Detail

    - #### run

          public static void run​(SourceSelection sourceSelection,
                                 List<SourceSelection.CheckTaskPair> tasks,
                                 SourceSelectionCache cache)

      Execute the given list of tasks in parallel, and block the thread until all tasks are completed. Synchronization is achieved by means of a latch. Results are added to the map of the source selection instance. Errors are reported as `OptimizationException` instances.
      Parameters:
        `tasks` -

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`

    - #### addResult

          public void addResult​(CloseableIteration<BindingSet,​QueryEvaluationException> res)

      Description copied from interface: `ParallelExecutor`
      Handle the result appropriately, e.g. add it to the result iteration. Take care for synchronization in a multithreaded environment
      Specified by:
        `addResult` in interface `ParallelExecutor<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>`

    - #### 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>`

    - #### isFinished

          public boolean isFinished()

      Description copied from interface: `ParallelExecutor`
      Return true if this executor is finished or aborted
      Specified by:
        `isFinished` in interface `ParallelExecutor<BindingSet>`
      Returns:
        whether the execution is finished

    - #### getQueryInfo

          public QueryInfo getQueryInfo()

      Description copied from interface: `ParallelExecutor`
      Return the query info of the associated query
      Specified by:
        `getQueryInfo` in interface `ParallelExecutor<BindingSet>`
      Returns:
        the query info