Class ImmediateJobScheduler

java.lang.Object
io.deephaven.engine.table.impl.util.ImmediateJobScheduler
All Implemented Interfaces:
JobScheduler

public class ImmediateJobScheduler extends Object implements JobScheduler
A JobScheduler that runs jobs on the thread that submits them, with a thread count of one.

A submit from a thread that is not already running this scheduler's jobs runs the job before returning, along with every job submitted while it runs. Jobs submitted from within a running job are queued rather than run recursively, and the queue is drained most recently submitted first, so nested work runs depth-first rather than in submission order.

Only one thread may run this scheduler's jobs at a time: a submit from any other thread while jobs are running throws IllegalCallerException. A job that completes asynchronously must therefore resume on the running thread, or after the jobs have finished. An Error thrown by a job propagates out of the submit that is running it.