Package org.sdnplatform.sync.internal.config

Examples of org.sdnplatform.sync.internal.config.ClusterConfig


    })
    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());
View Full Code Here


                // and then bad things would start to happen.  We're essentially
                // assuming that node joins are happening one at a time by a
                // human; the randomness is a lame attempt to mitigate this race
                Random random = new Random();
                short newNodeId;
                ClusterConfig cc = syncManager.getClusterConfig();

                while (true) {
                    newNodeId = (short)random.nextInt(Short.MAX_VALUE);
                    if (cc.getNode(newNodeId) == null) break;
                }

                tnode.setNodeId(newNodeId);
                cjrm.setNewNodeId(newNodeId);
            }
View Full Code Here

TOP

Related Classes of org.sdnplatform.sync.internal.config.ClusterConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.