ConfigJSR icon indicating copy to clipboard operation
ConfigJSR copied to clipboard

Consider Initialization on demand for ConfigurationProviderResolver

Open agentgt opened this issue 6 years ago • 0 comments

The ConfigProvider (EDIT on name... apologies) has a static initializer.

For static initialization I usually use this pattern See https://en.wikipedia.org/wiki/Initialization-on-demand_holder_idiom to avoid unnecessary loading.

Thus

private static final ConfigProviderResolver INSTANCE = ConfigProviderResolver.instance();

Should be:

private static class LazyHolder { private static final ConfigProviderResolver INSTANCE = ConfigProviderResolver.instance(); }

Also sort of off topic but I was actually trying to get a configuration standard 2 years ago: https://github.com/agentgt/configfacade

I didn't have the clout or time to devote to pushing it so I'm excited about the future of this library.

I hadn't separated out enough of the "helper" functionality from the base interfaces in my version as I was still experimenting with the ergonomics of the library as well as I was also trying to add reloadable behavior and listeners (similar to archaius).

I think reloadable/listening behavior is important and might file an issue to maybe add support if thats OK.

agentgt avatar Mar 01 '18 14:03 agentgt