Class FeatureRefreshEvent
FeatureRefreshListeners after a feature refresh attempt.
A cache fallback after an upstream failure is unsuccessful with loadedFromCache set to true.
Counting refreshes: an event is published per refresh attempt, not per change,
so metrics that should track definition updates must filter on isFeaturesChanged().
This matters most on FeatureRefreshSource.SSE: a server event that carries no payload is
published as successful with featuresChanged == false. Named keep-alives
(heartbeat, keepalive, ping) are filtered out before reaching listeners,
but a payload-less event under any other name is indistinguishable from a genuine
"definitions changed, refetch" signal, so it is delivered rather than dropped — the remote-eval
cache invalidation depends on receiving it. GrowthBook Cloud emits such events roughly every
30 seconds, so counting raw events there overstates the refresh rate.
This is an immutable value carrier; identity equality is used. It intentionally does not define
field-based equals/hashCode, since the error and timestamp fields
make two refresh attempts effectively never equal.
-
Constructor Summary
ConstructorsConstructorDescriptionFeatureRefreshEvent(boolean successful, boolean featuresChanged, boolean loadedFromCache, Throwable error, int activeFeatureCount, FeatureRefreshSource source, FeatureRefreshStrategy refreshStrategy, long durationMillis, Instant timestamp) -
Method Summary
Modifier and TypeMethodDescriptionstatic FeatureRefreshEventfailure(Throwable error, boolean featuresChanged, boolean loadedFromCache, int activeFeatureCount, FeatureRefreshSource source, FeatureRefreshStrategy refreshStrategy) static FeatureRefreshEventfailure(Throwable error, boolean featuresChanged, boolean loadedFromCache, int activeFeatureCount, FeatureRefreshSource source, FeatureRefreshStrategy refreshStrategy, long durationMillis) intlonggetError()booleanbooleanbooleanstatic FeatureRefreshEventsuccess(boolean featuresChanged, boolean loadedFromCache, int activeFeatureCount, FeatureRefreshSource source, FeatureRefreshStrategy refreshStrategy) static FeatureRefreshEventsuccess(boolean featuresChanged, boolean loadedFromCache, int activeFeatureCount, FeatureRefreshSource source, FeatureRefreshStrategy refreshStrategy, long durationMillis) toString()
-
Constructor Details
-
FeatureRefreshEvent
public FeatureRefreshEvent(boolean successful, boolean featuresChanged, boolean loadedFromCache, @Nullable Throwable error, int activeFeatureCount, FeatureRefreshSource source, @Nullable FeatureRefreshStrategy refreshStrategy, long durationMillis, Instant timestamp)
-
-
Method Details
-
success
public static FeatureRefreshEvent success(boolean featuresChanged, boolean loadedFromCache, int activeFeatureCount, FeatureRefreshSource source, @Nullable FeatureRefreshStrategy refreshStrategy) -
success
public static FeatureRefreshEvent success(boolean featuresChanged, boolean loadedFromCache, int activeFeatureCount, FeatureRefreshSource source, @Nullable FeatureRefreshStrategy refreshStrategy, long durationMillis) -
failure
public static FeatureRefreshEvent failure(Throwable error, boolean featuresChanged, boolean loadedFromCache, int activeFeatureCount, FeatureRefreshSource source, @Nullable FeatureRefreshStrategy refreshStrategy) -
failure
public static FeatureRefreshEvent failure(Throwable error, boolean featuresChanged, boolean loadedFromCache, int activeFeatureCount, FeatureRefreshSource source, @Nullable FeatureRefreshStrategy refreshStrategy, long durationMillis) -
isSuccessful
public boolean isSuccessful() -
isFeaturesChanged
public boolean isFeaturesChanged() -
isLoadedFromCache
public boolean isLoadedFromCache() -
getError
-
getActiveFeatureCount
public int getActiveFeatureCount() -
getSource
-
getRefreshStrategy
-
getDurationMillis
public long getDurationMillis() -
getTimestamp
-
toString
-