@@ -59,12 +59,24 @@ public abstract class ReloadableClientConfig implements IClientConfig {
5959
6060 private boolean isLoaded = false ;
6161
62+ /**
63+ * @deprecated Use {@link #ReloadableClientConfig(PropertyResolver, String, String)}
64+ */
65+ @ Deprecated
6266 protected ReloadableClientConfig (PropertyResolver resolver ) {
63- this .clientName = DEFAULT_CLIENT_NAME ;
64- this .resolver = resolver ;
67+ this (resolver , DEFAULT_CLIENT_NAME );
6568 }
6669
70+ /**
71+ * @deprecated Use {@link #ReloadableClientConfig(PropertyResolver, String, String)}
72+ */
73+ @ Deprecated
6774 protected ReloadableClientConfig (PropertyResolver resolver , String clientName ) {
75+ this (resolver , DEFAULT_NAMESPACE , DEFAULT_CLIENT_NAME );
76+ }
77+
78+ protected ReloadableClientConfig (PropertyResolver resolver , String namespace , String clientName ) {
79+ this .namespace = namespace ;
6880 this .clientName = clientName ;
6981 this .resolver = resolver ;
7082 }
@@ -106,14 +118,11 @@ public final void setNameSpace(String nameSpace) {
106118
107119 @ Override
108120 public void loadProperties (String clientName ) {
109- Preconditions .checkState (isLoaded == false , "Config '{}' can only be loaded once" , clientName );
110- if (!isLoaded ) {
111- loadDefaultValues ();
112- this .isLoaded = true ;
113- resolver .onChange (this ::reload );
114- }
115-
121+ Preconditions .checkState (!isLoaded , "Config '{}' can only be loaded once" , clientName );
116122 this .clientName = clientName ;
123+ this .isLoaded = true ;
124+ loadDefaultValues ();
125+ resolver .onChange (this ::reload );
117126 }
118127
119128 @ Override
@@ -202,8 +211,6 @@ interface ReloadableProperty<T> extends Property<T> {
202211 }
203212
204213 private <T > ReloadableProperty <T > getClientDynamicProperty (IClientConfigKey <T > key ) {
205- LOG .debug ("Get dynamic property key={} ns={} client={}" , key .key (), getNameSpace (), clientName );
206-
207214 return createProperty (
208215 () -> resolveFinalProperty (key ),
209216 key ::defaultValue );
@@ -295,18 +302,24 @@ public <T> Optional<T> getIfSet(IClientConfigKey<T> key) {
295302
296303 @ Override
297304 public final <T > Property <T > getDynamicProperty (IClientConfigKey <T > key ) {
305+ LOG .debug ("Get dynamic property key={} ns={} client={}" , key .key (), getNameSpace (), clientName );
306+
298307 return getClientDynamicProperty (key );
299308 }
300309
301310 @ Override
302311 public <T > Property <T > getScopedProperty (IClientConfigKey <T > key ) {
312+ LOG .debug ("Get dynamic property key={} ns={} client={}" , key .key (), getNameSpace (), clientName );
313+
303314 return (Property <T >) dynamicProperties .computeIfAbsent (key , ignore -> createProperty (
304315 () -> resolverScopedProperty (key ),
305316 key ::defaultValue ));
306317 }
307318
308319 @ Override
309320 public <T > Property <T > getPrefixMappedProperty (IClientConfigKey <T > key ) {
321+ LOG .debug ("Get dynamic property key={} ns={} client={}" , key .key (), getNameSpace (), clientName );
322+
310323 return (Property <T >) dynamicProperties .computeIfAbsent (key , ignore -> createProperty (
311324 getPrefixedMapPropertySupplier (key ),
312325 key ::defaultValue ));
0 commit comments