public final class ConfigEventManager extends Object
PropertySource
and Configuration
.Modifier and Type | Method and Description |
---|---|
static void |
addListener(ConfigEventListener l)
Adds a Config listener that listens to all kind of
ConfigEvent . |
static <T extends ConfigEvent> |
addListener(ConfigEventListener l,
Class<T> eventType)
Adds a Config listener that listens to all kind of
ConfigEvent . |
static void |
enableChangeMonitoring(boolean enable)
Start/Stop the change monitoring service, which will observe/reevaluate the current configuration regularly
and trigger ConfigurationChange events if something changed.
|
static <T> void |
fireEvent(ConfigEvent<?> event)
Publishes a
ConfigurationChange synchronously to all interested listeners. |
static <T> void |
fireEventAsynch(ConfigEvent<?> event)
Publishes a
ConfigurationChange asynchronously/multithreaded to all interested listeners. |
long |
getChangeMonitoringPeriod()
Get the current check period to check for configuration changes.
|
static <T extends ConfigEvent> |
getListeners()
Access all registered ConfigEventListeners listening to a all kind of event types globally.
|
static <T extends ConfigEvent> |
getListeners(Class<T> type)
Access all registered ConfigEventListeners listening to a given event type.
|
static boolean |
isChangeMonitoring()
Check if the observer is running currently.
|
static void |
removeListener(ConfigEventListener l)
Removes a listener registered globally.
|
static <T extends ConfigEvent> |
removeListener(ConfigEventListener l,
Class<T> eventType)
Removes a listener registered for the given event type.
|
void |
setChangeMonitoringPeriod(long millis)
Sets the current monitoring period and restarts the monitor.
|
public static void addListener(ConfigEventListener l)
ConfigEvent
.l
- the listener not null.public static <T extends ConfigEvent> void addListener(ConfigEventListener l, Class<T> eventType)
ConfigEvent
.T
- the type of the event.l
- the listener not null.eventType
- the event type to which this listener listens to.public static void removeListener(ConfigEventListener l)
l
- the listener not null.public static <T extends ConfigEvent> void removeListener(ConfigEventListener l, Class<T> eventType)
T
- the type of the event.l
- the listener, not null.eventType
- the event type to which this listener listens to.public static <T extends ConfigEvent> Collection<? extends ConfigEventListener> getListeners(Class<T> type)
T
- type paramtype
- the event typepublic static <T extends ConfigEvent> Collection<? extends ConfigEventListener> getListeners()
T
- the type of the event.public static <T> void fireEvent(ConfigEvent<?> event)
ConfigurationChange
synchronously to all interested listeners.T
- the type of the event.event
- the event, not null.public static <T> void fireEventAsynch(ConfigEvent<?> event)
ConfigurationChange
asynchronously/multithreaded to all interested listeners.T
- the type of the event.event
- the event, not null.public static void enableChangeMonitoring(boolean enable)
ConfigEventListener
have
to be registered, e.g. listening on ConfigurationChange
events.enable
- whether to enable or disable the change monitoring.isChangeMonitoring()
,
getChangeMonitoringPeriod()
public static boolean isChangeMonitoring()
enableChangeMonitoring(boolean)
public long getChangeMonitoringPeriod()
public void setChangeMonitoringPeriod(long millis)
millis
- the monitoring period in ms.enableChangeMonitoring(boolean)
,
isChangeMonitoring()
Copyright © 2014–2016 Apache Software Foundation. All rights reserved.