Fix for IOFSwitch/OFSwitchImpl leak
- Fix for ONOS-1765
- OFSwitchImpl.java
Changes TLS bufffer map to WeakHashMap to eliminate buffer for
eliminated switches.
- OFMessageDamper.java
Added a hack to remove cached entries related to disconnected switch
- TimedCache.java
Backdoor acccess to manually invalidate cached entries
- FlowProgrammer.java
Propagate removeSwitch event
FlowPusher -> OFMessageDamper to invalidate cache.
- FlowPusher.java
Switched `assignedQueues` to concurrent version of WeakHashMap
- PlanInstallRuntime.java
Changed FlowModCount map to WeakHashMap and removed
strong reference to IOFSwitch
Change-Id: Idb5014379ebc5658d0ae58ebcdbb2bf03e981df7
diff --git a/src/main/java/net/floodlightcontroller/util/TimedCache.java b/src/main/java/net/floodlightcontroller/util/TimedCache.java
index 2a90f0b..76f1e57 100644
--- a/src/main/java/net/floodlightcontroller/util/TimedCache.java
+++ b/src/main/java/net/floodlightcontroller/util/TimedCache.java
@@ -17,6 +17,7 @@
package net.floodlightcontroller.util;
+import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
@@ -60,7 +61,7 @@
* @return boolean
*/
public boolean update(K key) {
- Long curr = new Long(System.currentTimeMillis());
+ long curr = System.currentTimeMillis();
Long prev = cache.putIfAbsent(key, curr);
if (prev == null) {
@@ -75,4 +76,15 @@
return true;
}
+
+ /**
+ * Gets all the cached entries.
+ * <p/>
+ * Modification to the returned set will be reflected to the cache.
+ *
+ * @return cached entries
+ */
+ Set<K> getCachedEntries() {
+ return cache.keySet();
+ }
}