java.lang.Object
org.eclipse.milo.opcua.stack.core.util.ExecutionQueue

public class ExecutionQueue extends Object
Queues up submitted Runnables and executes on an Executor, with optional concurrency.

When concurrency = 1 (the default) submitted tasks are guaranteed to run serially and in the order submitted.

When concurrency > 1 there are no guarantees beyond the fact that tasks are still pulled from a queue to be executed.

  • Constructor Details

    • ExecutionQueue

      public ExecutionQueue(Executor executor)
    • ExecutionQueue

      public ExecutionQueue(Executor executor, int concurrencyLimit)
  • Method Details

    • submit

      public void submit(Runnable runnable)
      Submit a Runnable to be executed.
      Parameters:
      runnable - the Runnable to be executed.
    • submitToHead

      public void submitToHead(Runnable runnable)
      Submit a Runnable to be executed at the head of the queue.
      Parameters:
      runnable - the Runnable to be executed.
    • pause

      public void pause()
      Pause execution of queued Runnables.
    • resume

      public void resume()
      Resume execution of queued Runnables.