AsyncControl
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
class AsyncControl<R> {
AsyncControl<Void> returningVoid() (1)
AsyncControl<X> returning(Class<X> cls) (2)
AsyncControl<R> withSkipRules() (3)
AsyncControl<R> with(ExceptionHandler exceptionHandler) (4)
AsyncControl<R> with(ExecutorService executorService) (5)
AsyncControl<R> withClock(VirtualClock clock)
AsyncControl<R> withLocale(Locale locale)
AsyncControl<R> withTimeZone(ZoneId timeZone)
AsyncControl<R> withUser(UserMemento user) (6)
void setFuture(Future<R> future) (7)
R waitForResult(long timeout, TimeUnit unit) (8)
}
1 | returningVoid()
Factory method to instantiate a control instance for a void action or a property edit (where there is no need or intention to provide a return value through the |
2 | returning(Class)
Factory method to instantiate for a control instance for an action returning a value of |
3 | withSkipRules()
Skip checking business rules (hide/disable/validate) before executing the underlying property or action |
4 | with(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 | withUser(UserMemento)
Specifies the user for the session used to execute the command asynchronously, in the background. |
7 | setFuture(Future)
For framework use only. |
8 | waitForResult(long, TimeUnit)
Waits on the callers thread, for a maximum amount of time, for the result of the invocation to become available. |
Members
returningVoid()
Factory method to instantiate a control instance for a void action or a property edit (where there is no need or intention to provide a return value through the Future
).
returning(Class)
Factory method to instantiate for a control instance for an action returning a value of ` (where this value will be returned through the `Future
).
withSkipRules()
Skip checking business rules (hide/disable/validate) before executing the underlying property or action
with(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 .