Description
The openFeatureAPI instance implemented as singleton. We're allowing the client of OpenFeatureAPI to mutate the provider property. It results in undesirable effect on the flag evaluation when we need to use the multiple providers.
I created a sample repo to demonstrate the side effects here. https://github.com/thiyagu06/openfeature-demo
The demonstrated logic is expected to evaluate the feature flag using https://github.com/thiyagu06/openfeature-demo/blob/main/src/main/java/com/openfeature/demo/provider/InMemoryFeatureProvider.java, but it's not happening because of the mutation.
Also, When implementing the dispose
functionality open-feature/ofep#46, for every mutation of provider property, the dispose functionality needs to be called. If the logic inside the dispose
method is an costly operation, we might hit with performance penalty as well.
My opinion on this is, we shouldn't allow mutation on the singleton instance to avoid any side effects.