@Override public void dispatch() { counters.readyForReconcile.updateCounterWithFlush(); if (readyForReconcileListeners != null) { for (IReadyForReconcileListener listener: readyForReconcileListeners) { listener.readyForReconcile(); } } }
/** * Initialize internal data structures */ public void init(Map<String, String> configParams) { // These data structures are initialized here because other // module's startUp() might be called before ours this.messageListeners = new ConcurrentHashMap<OFType, ListenerDispatcher<OFType, IOFMessageListener>>(); this.switchListeners = new CopyOnWriteArraySet<IOFSwitchListener>(); // add switch notification listener this.addOFSwitchListener(new NotificationSwitchListener()); this.readyForReconcileListeners = new CopyOnWriteArraySet<IReadyForReconcileListener>(); this.haListeners = new ListenerDispatcher<HAListenerTypeMarker, IHAListener>(); this.driverRegistry = new NaiiveSwitchDriverRegistry(); this.controllerNodeIPsCache = new HashMap<String, String>(); this.updates = new LinkedBlockingQueue<IUpdate>(); this.factory = BasicFactory.getInstance(); this.providerMap = new HashMap<String, List<IInfoProvider>>(); setConfigParams(configParams); Role initialRole = getInitialRole(configParams); this.notifiedRole = initialRole; initVendorMessages(); String option = configParams.get("flushSwitchesOnReconnect"); if (option != null && option.equalsIgnoreCase("true")) { this.setAlwaysClearFlowsOnSwActivate(true); log.info("Flush switches on reconnect -- Enabled."); } else { this.setAlwaysClearFlowsOnSwActivate(false); log.info("Flush switches on reconnect -- Disabled"); } uplinkPortPrefixSet = new HashSet<String>(); uplinkPortPrefixSet.add("eth"); uplinkPortPrefixSet.add("bond"); String str = configParams.get("uplinkPortPrefix"); if (str != null) { List<String> items = Arrays.asList(str.split("\\s*,\\s*")); if (items != null) { for (String s: items) { if (s.length() > 0) { uplinkPortPrefixSet.add(s); } } } } this.roleManager = new RoleManager(this.notifiedRole, INITIAL_ROLE_CHANGE_DESCRIPTION); this.switchManager = new SwitchManager(this.notifiedRole); this.counters = new Counters(); this.swConnectCache = new TimedCache<Long>(100, 5*1000 ); // 5 seconds interval }
@Override public void addReadyForReconcileListener(IReadyForReconcileListener l) { this.readyForReconcileListeners.add(l); }
@Override public void addReadyForReconcileListener(IReadyForReconcileListener l) { // do nothing. }