})
protected void doUpdateConfiguration()
throws FloodlightModuleException {
try {
ClusterConfig oldConfig = clusterConfig;
clusterConfig = clusterConfigProvider.getConfig();
if (clusterConfig.equals(oldConfig)) return;
logger.info("[{}] Updating sync configuration {}",
clusterConfig.getNode().getNodeId(),
clusterConfig);
if (oldConfig.getNode() != null &&
!clusterConfig.getNode().equals(oldConfig.getNode())) {
logger.info("[{}] Local node configuration changed; restarting sync" +
"service", oldConfig.getNode().getNodeId());
shutdown();
startUp(null);
}
for (Node n : clusterConfig.getNodes()) {
Node existing = oldConfig.getNode(n.getNodeId());
if (existing != null && !n.equals(existing)) {
// we already had this node's configuration, but it's
// changed. Disconnect from the node and let it
// reinitialize
logger.debug("[{}->{}] Configuration for node has changed",
getLocalNodeId(), n.getNodeId());
rpcService.disconnectNode(n.getNodeId());
}
}
for (Node n : oldConfig.getNodes()) {
Node nn = clusterConfig.getNode(n.getNodeId());
if (nn == null) {
// n is a node that doesn't appear in the new config
logger.debug("[{}->{}] Disconnecting deconfigured node",
getLocalNodeId(), n.getNodeId());