Class ManagedReloadingDetector
java.lang.Object
org.apache.commons.configuration2.reloading.ManagedReloadingDetector
- All Implemented Interfaces:
ManagedReloadingDetectorMBean
,ReloadingDetector
public class ManagedReloadingDetector
extends Object
implements ReloadingDetector, ManagedReloadingDetectorMBean
A strategy to reload configuration based on management requests. Designed for JMX management.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.apache.commons.logging.Log
The logger.private boolean
A flag whether a reload is required. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks whether reloading is required.void
refresh()
Tells this strategy that the monitored configuration file should be refreshed.void
Notifies this object that a reload operation has been performed.
-
Field Details
-
log
private final org.apache.commons.logging.Log logThe logger. -
reloadingRequired
private volatile boolean reloadingRequiredA flag whether a reload is required.
-
-
Constructor Details
-
ManagedReloadingDetector
public ManagedReloadingDetector()
-
-
Method Details
-
isReloadingRequired
public boolean isReloadingRequired()Checks whether reloading is required. This implementation checks whether therefresh()
method has been invoked.- Specified by:
isReloadingRequired
in interfaceReloadingDetector
- Returns:
- a flag whether reloading is required
-
refresh
public void refresh()Tells this strategy that the monitored configuration file should be refreshed. This method will typically be called from outside (through an exposed MBean) on behalf of an administrator.- Specified by:
refresh
in interfaceManagedReloadingDetectorMBean
- See Also:
-
reloadingPerformed
public void reloadingPerformed()Notifies this object that a reload operation has been performed. This method is called afterreloadingRequired()
has returned true. It can be used to reset internal state in order to detect the next reload operation. This implementation resets the internal flag indicating that a reload should be performed.- Specified by:
reloadingPerformed
in interfaceReloadingDetector
-