Class RuntimeRollup
java.lang.Object
io.hypersistence.optimizer.core.event.persistence.RuntimeRollup
The
RuntimeRollup is a mutable accumulator that aggregates all the runtime events
sharing the same signature within the same time window.
Instead of storing one database row per event occurrence, the aggregator keeps a single
RuntimeRollup per (signature, window) pair, tracking the number of occurrences and,
when the events expose a duration, the total and maximum durations.
- Since:
- 2.14.0
- Author:
- Vlad Mihalcea
-
Constructor Summary
ConstructorsConstructorDescriptionRuntimeRollup(String eventName, String signature, String priority, long windowStart, long windowEnd) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the rollup prior to persisting it, so that its values no longer change and any occurrence recorded concurrently goes into a new rollup instead of being lost.Get the maximum duration, ornullwhen none of the aggregated events exposed one.longGet the total duration, ornullwhen none of the aggregated events exposed one.longlongbooleanRecord a single occurrence into this rollup.
-
Constructor Details
-
RuntimeRollup
-
-
Method Details
-
record
Record a single occurrence into this rollup.- Parameters:
durationMillis- the duration of the occurrence, ornullif not availabledescription- a representative description (kept only for the first occurrence)- Returns:
trueif the occurrence was recorded, orfalseif the rollup was already closed, in which case the occurrence must be recorded into a new rollup
-
close
public void close()Close the rollup prior to persisting it, so that its values no longer change and any occurrence recorded concurrently goes into a new rollup instead of being lost. -
getEventName
-
getSignature
-
getPriority
-
getWindowStart
public long getWindowStart() -
getWindowEnd
public long getWindowEnd() -
getOccurrenceCount
public long getOccurrenceCount() -
getTotalDurationMillis
Get the total duration, ornullwhen none of the aggregated events exposed one.- Returns:
- the total duration in milliseconds, or
null
-
getMaxDurationMillis
Get the maximum duration, ornullwhen none of the aggregated events exposed one.- Returns:
- the maximum duration in milliseconds, or
null
-
getSampleDescription
-