Class FeatureRepositoryProvider

java.lang.Object
growthbook.sdk.java.multiusermode.internal.FeatureRepositoryProvider

public final class FeatureRepositoryProvider extends Object
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. Provides the feature repository owned by GrowthBookClient.

This class hides lazy repository creation, initialization reuse, failed-initialization retry, and shutdown cleanup from the public client facade.

  • Constructor Details

    • FeatureRepositoryProvider

      public FeatureRepositoryProvider(Options options, Consumer<GBFeaturesRepository> configureRepository, Consumer<GBFeaturesRepository> onRepositoryReady)
      Creates a provider using the default GrowthBook repository factory.
      Parameters:
      options - client options used to create the repository
      configureRepository - callback invoked before repository initialization
      onRepositoryReady - callback invoked after repository initialization succeeds
  • Method Details

    • initialize

      public GBFeaturesRepository initialize()
      Initializes the repository if needed and returns the initialized repository.
      Returns:
      initialized repository, or null when initialization failed or was cancelled
    • lastInitializationError

      @Nullable public Throwable lastInitializationError()
      Returns:
      the cause of the most recent failed initialization, or null when the last initialization succeeded (or none has run). Used to surface repository init failures in client diagnostics, since initialize() intentionally swallows them.
    • currentRepository

      public GBFeaturesRepository currentRepository()
      Returns the initialized repository when available.
      Returns:
      initialized repository, or null when the client is not ready
    • shutdown

      public void shutdown()
      Detaches and shuts down the current repository.