Hey, I'm reading the code for java sdk and see a c...
# announcements
b
Hey, I'm reading the code for java sdk and see a class called
GBFeaturesRepository
It seems to implement caching and refreshing features at a defined interval. But there is no mention of this in docs and it seems incomplete in the sense where I'm unable to find the usages of
refreshCallbacks
array and implementation of `FeatureRefreshCallback`interface. Can someone help me in understanding this and should I use this class or manually fetch the features and pass to the constructor? Thanks in advance for help
f
b
understood, but then repo maintains its own feature set and context maintains its own feature set which are different. So I should manually update the context feature by using the featureRefreshCallback? or else I'll never know when the poll ends and features are always stale. I think this should be automatically handled by the SDK itself
f
Is this for Android or server-side Java? For server-side, we recommend creating a new Context for every incoming request. The context has targeting attributes unique to the request/user so this approach keeps the code much simpler. When the feature repository updates, any new Context objects created after that point will pick up the new features. You likely don't want feature values to change half way through a single HTTP request anyway.