Execution
Represents an action invocation/property edit as a node in a call-stack execution graph, with sub-interactions being made by way of the WrapperFactory ).
The Interaction has a reference to a Interaction#getCurrentExecution() top-level execution.
API
class Execution<T, E> {
void setParent(Execution<?, ?> parent) (1)
List<Execution<?, ?>> getChildren() (2)
E getEvent()
void setEvent(E event) (3)
Timestamp start(ClockService clockService, MetricsService metricsService)
void setCompletedAt(Timestamp completedAt, MetricsService metricsService) (4)
void setReturned(Object returned) (5)
void setThrew(Exception threw) (6)
void setDto(T executionDto) (7)
}
1 | setParent(Execution)
*NOT API* : intended to be called only by the framework. |
2 | getChildren()
The actions/property edits made in turn via the WrapperFactory . |
3 | setEvent(E)
*NOT API* : intended to be called only by the framework. |
4 | setCompletedAt(Timestamp, MetricsService)
*NOT API* : intended to be called only by the framework. |
5 | setReturned(Object)
*NOT API* : intended to be called only by the framework. |
6 | setThrew(Exception)
*NOT API* : intended to be called only by the framework. |
7 | setDto(T)
*NOT API* : Set by framework (implementation of _org.apache.causeway.core.metamodel.execution.InternalInteraction.MemberExecutor_ ) |
Members
getChildren()
The actions/property edits made in turn via the WrapperFactory .
Implementation
This is an abstract class with two concrete subclasses
-
ActionInvocation
represents the execution of an action being invoked:public class ActionInvocation extends Execution { public List<Object> getArgs(); (1) }
1 | The objects passed in as the arguments to the action’s parameters.
Any of these could be null .
|
public class PropertyEdit extends Execution { public Object getNewValue(); (1) }
1 | The object used as the new value of the property.
Could be null if the property is being cleared. |
Usage Notes
Execution
s can be subscribed to using the ExecutionSubscriber interface.
+ One reason to subscribe is to persist these interaction/executions. This supports several use cases:
-
they enable profiling of the running application (which actions are invoked then most often, what is their response time)
-
if auditing is configured (using EntityPropertyChangeSubscriber), they provide better audit information, since the parent Interaction captures the 'cause' of an interaction and can be correlated to the audit records (the "effect" of the interaction) by way of the interactionId that both share.
See also
-
Execution Log extension
which subscribes to
Execution
s and simply persists as ExecutionLogEntrys. -
Execution Outbox extension
which subscribes to
Execution
s and (similarly) persists as ExecutionOutboxEntrys. However, the outbox extension also provides a REST API which allows outbox entries to be queried and consumed, in other words providing an implementation of the Outbox pattern.