Class GlobalContextManager
java.lang.Object
growthbook.sdk.java.multiusermode.internal.GlobalContextManager
INTERNAL: not part of the supported API. Public only because
GrowthBookClient lives in
the parent package — treat its signatures as free to change without a major version bump.
Internal coordinator for the client-level GlobalContext.
Keeps feature state updates and evaluation context creation outside the public facade.-
Constructor Summary
ConstructorsConstructorDescriptionGlobalContextManager(Options options) Creates a manager bound to the client options instance. -
Method Summary
Modifier and TypeMethodDescriptioncreateEvaluationContext(UserContext userContext) Creates an evaluation context for a specific user by overlaying user attributes on global attributes.createEvaluationContext(UserContext userContext, GlobalContext globalContext) Creates an evaluation context against a caller-provided feature snapshot, so a feature refresh landing mid-request cannot pair sticky identifiers derived from one snapshot with evaluation against another.intThe current managed global context (or an empty fallback), exposed so the client can derive the sticky-bucket identifier attributes from the loaded feature snapshot.voidinitialize(GBFeaturesRepository repository) Replaces the managed context with feature data from the initialized repository.voidrefresh(GBFeaturesRepository repository) Updates feature and saved-group data after a repository refresh.
-
Constructor Details
-
GlobalContextManager
Creates a manager bound to the client options instance.- Parameters:
options- client options used to build evaluation contexts
-
-
Method Details
-
initialize
Replaces the managed context with feature data from the initialized repository.- Parameters:
repository- initialized feature repository
-
refresh
Updates feature and saved-group data after a repository refresh.- Parameters:
repository- repository containing the latest parsed feature data
-
createEvaluationContext
Creates an evaluation context for a specific user by overlaying user attributes on global attributes.- Parameters:
userContext- per-user evaluation context- Returns:
- evaluation context used by feature and experiment evaluators
-
createEvaluationContext
public EvaluationContext createEvaluationContext(UserContext userContext, GlobalContext globalContext) Creates an evaluation context against a caller-provided feature snapshot, so a feature refresh landing mid-request cannot pair sticky identifiers derived from one snapshot with evaluation against another.- Parameters:
userContext- per-user evaluation contextglobalContext- the feature snapshot to evaluate against- Returns:
- evaluation context used by feature and experiment evaluators
-
getCurrentGlobalContext
The current managed global context (or an empty fallback), exposed so the client can derive the sticky-bucket identifier attributes from the loaded feature snapshot. -
featureCount
public int featureCount()- Returns:
- number of features in the current global context (0 when uninitialized).
-