if(newGraph.containsKey(src))
deletedDestList.removeAll(newGraph.get(src));
Vector<Exchange> routeDestList = routeTable.get(src);
for(String dest : deletedDestList)
routeDestList.remove(new Exchange(dest));
if(routeDestList.size() == 0)
routeTable.remove(src);
}
// Add new rules from the new graph
for(Entry<String, ArrayList<String>> ent : newGraph.entrySet()) {
String src = ent.getKey();
ArrayList<String> newDestList = new ArrayList<String>(newGraph.get(src));
if(oldGraph.containsKey(src))
newDestList.removeAll(oldGraph.get(src));
Vector<Exchange> routeDestList = routeTable.get(src);
if(routeDestList == null) {
routeDestList = new Vector<Exchange>();
routeTable.put(src, routeDestList);
}
for(String dest : newDestList) {
routeDestList.add(new Exchange(dest));
}
}
rwlock.writeLock().unlock();
// Store the new graph