Package org.opennms.core.config.api
Class ConfigReloadContainer<V>
- java.lang.Object
-
- org.opennms.core.config.api.ConfigReloadContainer<V>
-
- Type Parameters:
V
- type of configuration bean
- All Implemented Interfaces:
ReloadingContainer<V>
,RegistrationListener<ConfigurationProvider>
public class ConfigReloadContainer<V> extends java.lang.Object implements ReloadingContainer<V>, RegistrationListener<ConfigurationProvider>
A container for managing configuration that sources the configuration from one or moreConfigurationProvider
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConfigReloadContainer.Builder<V>
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Long
getLastUpdate()
Retrieve the time at which the object was last updated.V
getObject()
Retrieve the object held by the container.void
providerRegistered(Registration registration, ConfigurationProvider provider)
providerRegisteredvoid
providerUnregistered(Registration registration, ConfigurationProvider provider)
providerUnregisteredvoid
reload()
Immediately reload the object.void
setReloadCheckInterval(java.lang.Long reloadCheckInterval)
Set the frequency at which the object should be checked for updates.
-
-
-
Method Detail
-
getObject
public V getObject()
Description copied from interface:ReloadingContainer
Retrieve the object held by the container. May also trigger a reload if the check interval has passed.- Specified by:
getObject
in interfaceReloadingContainer<V>
- Returns:
- the object
-
reload
public void reload()
Description copied from interface:ReloadingContainer
Immediately reload the object. The next call toReloadingContainer.getObject()
will return the updated object.- Specified by:
reload
in interfaceReloadingContainer<V>
-
setReloadCheckInterval
public void setReloadCheckInterval(java.lang.Long reloadCheckInterval)
Description copied from interface:ReloadingContainer
Set the frequency at which the object should be checked for updates. The check is performed when calls toReloadingContainer.getObject()
are made once the interval has passed.- Specified by:
setReloadCheckInterval
in interfaceReloadingContainer<V>
- Parameters:
reloadCheckInterval
- interval in ms, ifnull
the default value will be used, if <= 0 reload checks will be disabled
-
getLastUpdate
public java.lang.Long getLastUpdate()
Description copied from interface:ReloadingContainer
Retrieve the time at which the object was last updated.- Specified by:
getLastUpdate
in interfaceReloadingContainer<V>
- Returns:
- timestamp in ms
-
providerRegistered
public void providerRegistered(Registration registration, ConfigurationProvider provider)
Description copied from interface:RegistrationListener
providerRegistered
- Specified by:
providerRegistered
in interfaceRegistrationListener<V>
- Parameters:
registration
- aRegistration
object.provider
- a T object.
-
providerUnregistered
public void providerUnregistered(Registration registration, ConfigurationProvider provider)
Description copied from interface:RegistrationListener
providerUnregistered
- Specified by:
providerUnregistered
in interfaceRegistrationListener<V>
- Parameters:
registration
- aRegistration
object.provider
- a T object.
-
-