Class AsyncGroup
java.lang.Object
com.github.sttk.sabi.AsyncGroup
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface representing an asynchronous unit of work registered with anAsyncGroup. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(AsyncGroup.Task task) Adds a task to be executed asynchronously on a virtual thread within this group.
-
Method Details
-
add
Adds a task to be executed asynchronously on a virtual thread within this group.- Parameters:
task- theAsyncGroup.Taskto execute asynchronously
-