MetricsService (interface)

Hooks into the transaction nechanism to provide a counters relating to numbers of object loaded, dirtied etc.

Only entities with DomainObject#entityChangePublishing() enabled are counted.

API

MetricsService.java
interface MetricsService {
  int numberEntitiesLoaded()     (1)
  int numberEntitiesDirtied()     (2)
}
1 numberEntitiesLoaded()

The number of entities that have, so far in this request, been loaded from the database.

2 numberEntitiesDirtied()

The number of objects that have, so far in this request, been dirtied/will need updating in the database); a good measure of the footprint of the interaction.

Members

numberEntitiesLoaded()

The number of entities that have, so far in this request, been loaded from the database.

Corresponds to the number of times that javax.jdo.listener.LoadLifecycleListener#postLoad(InstanceLifecycleEvent) (or equivalent) is fired.

Is captured within MemberExecutionDto#getMetrics() (accessible from InteractionProvider#currentInteraction() ).

numberEntitiesDirtied()

The number of objects that have, so far in this request, been dirtied/will need updating in the database); a good measure of the footprint of the interaction.

Corresponds to the number of times that javax.jdo.listener.DirtyLifecycleListener#preDirty(InstanceLifecycleEvent) (or equivalent) callback is fired.

Is captured within MemberExecutionDto#getMetrics() (accessible from InteractionProvider#currentInteraction() .

Implementation

The framework provides a default of this service, namely o.a.i.core.transaction.changetracking.EntityChangeTrackerDefault.

This supports both JDO and JPA persistence mechanisms.