private FileWatchdog systemConfWatchDog;
private FileWatchdog policyJsWatchDog;
protected void initHomeMonitor() {
checkNotNull(home);
this.announcementWatchDog = new FileWatchdog(getHome().getSubFile("announcement.conf").getAbsolutePath()) {
@Override
protected void doOnChange() {
CoreLogger.LOGGER.info("Announcement file is changed.");
loadAnnouncement();
}
};
announcementWatchDog.setName("WatchDog - announcement.conf");
announcementWatchDog.setDelay(2000);
announcementWatchDog.start();
this.systemConfWatchDog = new FileWatchdog(getHome().getSubFile("system.conf").getAbsolutePath()) {
@Override
protected void doOnChange() {
try {
CoreLogger.LOGGER.info("System configuration(system.conf) is changed.");
loadProperties();
systemConfListeners.apply(new Informer<PropertyChangeListener>() {
@Override
public void inform(PropertyChangeListener listener) {
listener.propertyChange(null);
}
});
CoreLogger.LOGGER.info("New system configuration is applied.");
} catch (Exception e) {
CoreLogger.LOGGER.error("Error occurs while applying new system configuration", e);
}
}
};
systemConfWatchDog.setName("WatchDoc - system.conf");
systemConfWatchDog.setDelay(2000);
systemConfWatchDog.start();
String processThreadPolicyPath = getHome().getSubFile("process_and_thread_policy.js").getAbsolutePath();
this.policyJsWatchDog = new FileWatchdog(processThreadPolicyPath) {
@Override
protected void doOnChange() {
CoreLogger.LOGGER.info("process_and_thread_policy file is changed.");
policyScript = "";
}