Class SceneTaskGroup

java.lang.Object
com.victorvalentim.zividomelive.SceneTaskGroup

public final class SceneTaskGroup extends Object
Bounded, activation-owned background work backed by the library's shared worker pool.

Work executes outside the Processing/OpenGL thread and must not call Processing graphics APIs. Result and error handlers are delivered at a later frame boundary only while the same activation remains alive. Disposal cancels in-flight work, rejects new submissions, and drops stale callbacks.

This API is callback-based by design: it never exposes a Future that could encourage blocking the render thread.

API stability: Advanced Stable.

Since:
2.0.0
  • Method Details

    • submitIfIdle

      public boolean submitIfIdle(String key, Runnable task)
      Submits keyed background work only when that key is idle and capacity is available.

      This overload has no result callback. Unhandled failures are written to the library log.

      Parameters:
      key - stable task key
      task - background work that must not call Processing/OpenGL APIs
      Returns:
      true when accepted; false when the key is busy or the bounded group is full
    • submitIfIdle

      public <T> boolean submitIfIdle(String key, Callable<T> task, Consumer<? super T> onResult)
      Runs keyed work in the shared background pool and publishes its result at the next frame boundary of this activation.
      Type Parameters:
      T - result type
      Parameters:
      key - stable task key
      task - background work that must not call Processing/OpenGL APIs
      onResult - result handler executed on the Processing render thread
      Returns:
      true when accepted; false when the key is busy or the bounded group is full
    • submitIfIdle

      public <T> boolean submitIfIdle(String key, Callable<T> task, Consumer<? super T> onResult, Consumer<? super Throwable> onError)
      Runs keyed work in the shared background pool and publishes either its result or failure at the next frame boundary of this activation.
      Type Parameters:
      T - result type
      Parameters:
      key - stable task key
      task - background work that must not call Processing/OpenGL APIs
      onResult - result handler executed on the Processing render thread
      onError - failure handler executed on the Processing render thread
      Returns:
      true when accepted; false when the key is busy or the bounded group is full
    • isBusy

      public boolean isBusy(String key)
      Reports whether keyed work is currently in flight.
      Parameters:
      key - task key
      Returns:
      true while queued or running
    • getInFlightCount

      public int getInFlightCount()
      Returns:
      current number of queued or running background tasks
    • getMaxInFlight

      public int getMaxInFlight()
      Returns:
      maximum number of distinct keyed tasks allowed in flight