Package com.victorvalentim.zividomelive
Class SceneTaskGroup
java.lang.Object
com.victorvalentim.zividomelive.SceneTaskGroup
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 Summary
Modifier and TypeMethodDescriptionintintbooleanReports whether keyed work is currently in flight.booleansubmitIfIdle(String key, Runnable task) Submits keyed background work only when that key is idle and capacity is available.<T> booleansubmitIfIdle(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.<T> booleansubmitIfIdle(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.
-
Method Details
-
submitIfIdle
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 keytask- background work that must not call Processing/OpenGL APIs- Returns:
truewhen accepted;falsewhen the key is busy or the bounded group is full
-
submitIfIdle
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 keytask- background work that must not call Processing/OpenGL APIsonResult- result handler executed on the Processing render thread- Returns:
truewhen accepted;falsewhen 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 keytask- background work that must not call Processing/OpenGL APIsonResult- result handler executed on the Processing render threadonError- failure handler executed on the Processing render thread- Returns:
truewhen accepted;falsewhen the key is busy or the bounded group is full
-
isBusy
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
-