T - The configuration class that would hold the response of the api pollpublic abstract class PollingRemoteConfigurationSource<T> extends Object implements RemoteConfigurationSource<T>
PollingRemoteConfigurationSource class provides a generic polling implementation
for remote configuration sources. It uses a single thread executor to poll the remote source.| Constructor and Description |
|---|
PollingRemoteConfigurationSource(long refreshIntervalMs,
Consumer<T> callback,
Class<T> typeParameterClass) |
| Modifier and Type | Method and Description |
|---|---|
T |
getConfig()
This method is used to get the current configuration before starting
the polling.
|
void |
setConfigurationChangeCallback(Consumer<T> callback)
Only one callback can be registered.
|
void |
start() |
void |
stop() |
public PollingRemoteConfigurationSource(long refreshIntervalMs,
Consumer<T> callback,
Class<T> typeParameterClass)
refreshIntervalMs - - Executor service delay in millisecondscallback - - The callback to be called by the scheduled executor thread after polling the remote sourcetypeParameterClass - - The class type of the configuration object that would hold the response of the api pollpublic T getConfig()
getConfig in interface RemoteConfigurationSource<T>public void setConfigurationChangeCallback(Consumer<T> callback)
setConfigurationChangeCallback in interface RemoteConfigurationSource<T>public void stop()
stop in interface RemoteConfigurationSource<T>public void start()
start in interface RemoteConfigurationSource<T>