# Interface WorkQueue

public interface WorkQueue
Represents a queue of work items with a uniform set of worker requirements. Note that this object is not thread-safe.

Since:
  5.6

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `await()`
  Blocks until all work associated with this queue is complete.
  `<T extends WorkParameters>
  void`
  `submit(Class<? extends WorkAction<T>> workActionClass, Action<? super T> parameterAction)`
  Submits a piece of work to be executed asynchronously.

- ## Method Details

  - ### submit

    <T extends WorkParameters> void submit(Class<? extends WorkAction<T>> workActionClass, Action<? super T> parameterAction)
    Submits a piece of work to be executed asynchronously. Execution of the work may begin immediately. Work submitted using `WorkerExecutor.processIsolation()` will execute in an idle daemon that meets the requirements set in the `ProcessWorkerSpec`. If no idle daemons are available, a new daemon will be started. Any errors will be thrown from `await()` or from the surrounding task action if `await()` is not used.

    The `parameterAction` is invoked even when the work action declares `WorkParameters.None` as its parameters type; in that case it receives the `WorkParameters.None` singleton.

  - ### await

    void await() throws WorkerExecutionException
    Blocks until all work associated with this queue is complete. Note that when using this method inside a task action, it will block completion of the task action until the submitted work is complete. This means that other tasks from the same project cannot be run in parallel while the task action is still executing.
    Throws:
      `WorkerExecutionException` - when a failure occurs while executing the work.