Class AsyncGroup

java.lang.Object
com.github.sttk.sabi.AsyncGroup

public final class AsyncGroup extends Object
Manages asynchronous background tasks executed during data source and data connection lifecycle events.

An instance of AsyncGroup is passed to methods of DataSrc (such as DataSrc.setup(AsyncGroup)) and DataConn (such as DataConn.preCommit(AsyncGroup), DataConn.commit(AsyncGroup), DataConn.postCommit(AsyncGroup), DataConn.rollback(AsyncGroup), and DataConn.onTxnFailure(AsyncGroup, List)). Implementations of data sources and data connections can register asynchronous operations using add(Task).

Registered AsyncGroup.Task instances are executed on virtual threads and joined when the lifecycle phase completes. Any Err, RuntimeException, or Throwable thrown by a task is captured and reported via AsyncGroupError and ErrEntry.

An instance of this class is considered consumed after join() is called and cannot be reused.

  • Method Details

    • add

      public void add(AsyncGroup.Task task)
      Adds a task to be executed asynchronously on a virtual thread within this group.
      Parameters:
      task - the AsyncGroup.Task to execute asynchronously