Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Async

[21:14] static extends: object

Helper for FXGL's Async singleton (com.almasb.fxgl.core.concurrent.Async), the default Executor used by FXGL for background work. Distinct from the existing IOTaskExecutorService wrapper: Async runs raw Callables / Runnables on a cached thread pool (or the JavaFX thread for the FX variants) without the IOTask onSuccess/onFailure scaffolding. Aussom users typically reach Async through fxgl.getExecutor() (which returns this object); this helper provides the convenience static-style API.

Methods

  • startAsync (callback Cb)

    Submits a Runnable to FXGL's background executor and returns an AsyncTask whose await() returns null when the Runnable finishes.

    • @p Cb is the action to run.
    • @r An AsyncTask wrapper.
  • startAsyncCallable (callback Cb)

    Submits a Callable to FXGL's background executor and returns an AsyncTask whose await() yields the result.

    • @p Cb is the callable returning the result.
    • @r An AsyncTask wrapper.
  • startAsyncFX (callback Cb)

    Submits a Runnable that runs on the JavaFX Application thread.

    • @p Cb is the action to run on the FX thread.
    • @r An AsyncTask wrapper.
  • startAsyncFXCallable (callback Cb)

    Submits a Callable that runs on the JavaFX Application thread.

    • @p Cb is the callable to run on the FX thread.
    • @r An AsyncTask wrapper.
  • schedule (callback Cb, double DelaySeconds)

    Schedules a Runnable to run after DelaySeconds. The returned ScheduledFuture supports cancel() through its AJO.

    • @p Cb is the action to run.
    • @p DelaySeconds is the delay in seconds.
    • @r An AussomJavaObject around a ScheduledFuture.
  • shutdownNow ()

    Shuts down every background thread used by the default Async executor. Typically called during application teardown.