AsyncControl (record)
Modifies the way in which an asynchronous action initiated through the WrapperFactory is actually executed.
Executing in a separate thread means that the target and arguments are used in a new org.apache.causeway.applib.services.iactn.Interaction (and transaction). If any of these are entities, they are retrieved from the database afresh; it isn’t possible to pass domain entity references from the foreground calling thread to the background threads.
API
record AsyncControl {
AsyncControl defaults()
AsyncControl withExecute() (1)
AsyncControl withNoExecute() (2)
AsyncControl withSkipRules() (3)
AsyncControl withCheckRules()
AsyncControl withExceptionHandler(ExceptionHandler exceptionHandler) (4)
AsyncControl with(ExecutorService executorService) (5)
AsyncControl listen(SyncControl.@NonNull CommandListener commandListener)
AsyncControl withClock(VirtualClock clock) (6)
AsyncControl withLocale(Locale locale) (7)
AsyncControl withTimeZone(ZoneId timeZone) (8)
AsyncControl withUser(UserMemento user) (9)
InteractionContext override(InteractionContext interactionContext)
}
1 | withExecute()
Explicitly set the action to be executed. |
2 | withNoExecute()
Explicitly set the action to not be executed, in other words a 'dry run'. |
3 | withSkipRules()
Skip checking business rules (hide/disable/validate) before executing the underlying property or action |
4 | withExceptionHandler(ExceptionHandler)
How to handle exceptions if they occur, using the provided ExceptionHandler . |
5 | with(ExecutorService)
Specifies the ExecutorService to use to obtain the thread to invoke the action. |
6 | withClock(VirtualClock)
Defaults to the system clock, if not overridden |
7 | withLocale(Locale)
Defaults to the system locale, if not overridden |
8 | withTimeZone(ZoneId)
Defaults to the system time zone, if not overridden |
9 | withUser(UserMemento)
Specifies the user for the session used to execute the command asynchronously, in the background. |
Members
withSkipRules()
Skip checking business rules (hide/disable/validate) before executing the underlying property or action
withExceptionHandler(ExceptionHandler)
How to handle exceptions if they occur, using the provided ExceptionHandler .
The default behaviour is to rethrow the exception.
with(ExecutorService)
Specifies the ExecutorService to use to obtain the thread to invoke the action.
The default is null , indicating, that its the WrapperFactory 's responsibility to provide a suitable ExecutorService .