Interface JobScheduler.IterateAction<CONTEXT_TYPE extends JobScheduler.JobThreadContext>

Enclosing interface:
JobScheduler
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface JobScheduler.IterateAction<CONTEXT_TYPE extends JobScheduler.JobThreadContext>
Helper interface for JobScheduler.iterateParallel(io.deephaven.engine.context.ExecutionContext, io.deephaven.base.log.LogOutputAppendable, java.util.function.Supplier<CONTEXT_TYPE>, int, int, io.deephaven.engine.table.impl.util.JobScheduler.IterateAction<CONTEXT_TYPE>, java.lang.Runnable, java.lang.Runnable, java.util.function.Consumer<java.lang.Exception>) and JobScheduler.invokeParallel(io.deephaven.engine.context.ExecutionContext, io.deephaven.base.log.LogOutputAppendable, java.util.function.Supplier<CONTEXT_TYPE>, int, int, io.deephaven.engine.table.impl.util.JobScheduler.IterateAction<CONTEXT_TYPE>). This provides a functional interface with index indicating which iteration to perform. When this returns, the scheduler will automatically schedule the next iteration.

A task in this form fails by throwing, and should not call its nested error consumer: since the iteration moves on as soon as the task returns, a failure reported there is fatal unless the task then throws that same failure, and JobScheduler.invokeParallel(io.deephaven.engine.context.ExecutionContext, io.deephaven.base.log.LogOutputAppendable, java.util.function.Supplier<CONTEXT_TYPE>, int, int, io.deephaven.engine.table.impl.util.JobScheduler.IterateAction<CONTEXT_TYPE>) may return before the task does. Nor should it hand the consumer to nested work that it then waits on: a call to the consumer from another thread waits for the task to return, so that work failing deadlocks the task. Nested work that completes asynchronously needs JobScheduler.IterateResumeAction.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run(CONTEXT_TYPE taskThreadContext, int index, Consumer<Exception> nestedErrorConsumer)
    Iteration action to be invoked.
  • Method Details

    • run

      void run(CONTEXT_TYPE taskThreadContext, int index, Consumer<Exception> nestedErrorConsumer)
      Iteration action to be invoked.
      Parameters:
      taskThreadContext - The context, unique to this task-thread
      index - The iteration number
      nestedErrorConsumer - A consumer that a task in this form should not call; see JobScheduler.IterateAction