Class PollingRemoteConfigurationSource<T>
java.lang.Object
io.confluent.security.audit.telemetry.exporter.config.remote.polling.PollingRemoteConfigurationSource<T>
- Type Parameters:
T- The configuration class that would hold the response of the api poll
- All Implemented Interfaces:
ICallbackResponse,RemoteConfigurationSource<T>
- Direct Known Subclasses:
KubernetesConfigMapRemoteConfigurationSource
public abstract class PollingRemoteConfigurationSource<T>
extends Object
implements RemoteConfigurationSource<T>, ICallbackResponse
This
PollingRemoteConfigurationSource class provides a generic polling implementation
for remote configuration sources. It uses a single thread executor to poll the remote source.-
Constructor Summary
ConstructorsConstructorDescriptionPollingRemoteConfigurationSource(long refreshIntervalMs, Consumer<T> callback, Class<T> typeParameterClass) -
Method Summary
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.confluent.security.audit.telemetry.exporter.config.remote.polling.ICallbackResponse
onCallbackFailure, onCallbackSuccess
-
Constructor Details
-
PollingRemoteConfigurationSource
public PollingRemoteConfigurationSource(long refreshIntervalMs, Consumer<T> callback, Class<T> typeParameterClass) - Parameters:
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 poll
-
-
Method Details
-
getConfig
This method is used to get the current configuration before starting the polling. It's useful to get the initial configuration before starting the polling.- Specified by:
getConfigin interfaceRemoteConfigurationSource<T>- Returns:
- currentConfig
-
setConfigurationChangeCallback
Only one callback can be registered. If a callback is already registered it'll be replaced by new provided callback- Specified by:
setConfigurationChangeCallbackin interfaceRemoteConfigurationSource<T>
-
stop
public void stop()- Specified by:
stopin interfaceRemoteConfigurationSource<T>
-
start
public void start()- Specified by:
startin interfaceRemoteConfigurationSource<T>
-