use of org.mobicents.tools.configuration.XmlConfigurationLoader in project load-balancer by RestComm.
the class SipBalancerShutdownHook method start.
/**
* @param configurationFileLocation
*/
public void start(final String configurationFileLocation) {
File file = new File(configurationFileLocation);
lastupdate = file.lastModified();
final XmlConfigurationLoader configLoader = new XmlConfigurationLoader();
LoadBalancerConfiguration lbConfig = configLoader.load(file);
timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
File conf = new File(configurationFileLocation);
if (lastupdate < conf.lastModified()) {
lastupdate = conf.lastModified();
logger.info("Configuration file changed, applying changes.");
try {
for (InvocationContext ctx : contexts.values()) {
balancerContext.lbConfig = configLoader.load(conf);
ctx.balancerAlgorithm.configurationChanged();
if (ctx.smppToNodeBalancerAlgorithm != null)
ctx.smppToNodeBalancerAlgorithm.configurationChanged();
ctx.smppToProviderBalancerAlgorithm.configurationChanged();
smppBalancerRunner.remoteServersUpdated();
}
} catch (Exception e) {
logger.warn("Problem reloading configuration " + e);
}
}
}
}, 3000, 2000);
start(lbConfig);
}
Aggregations