You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by hs...@apache.org on 2016/09/20 15:45:45 UTC

[2/4] apex-malhar git commit: APEXMALHAR-2245 #resolve Add the key in removedKeys even if the key does not appear in the cache

APEXMALHAR-2245 #resolve Add the key in removedKeys even if the key does not appear in the cache


Project: http://git-wip-us.apache.org/repos/asf/apex-malhar/repo
Commit: http://git-wip-us.apache.org/repos/asf/apex-malhar/commit/447b26df
Tree: http://git-wip-us.apache.org/repos/asf/apex-malhar/tree/447b26df
Diff: http://git-wip-us.apache.org/repos/asf/apex-malhar/diff/447b26df

Branch: refs/heads/master
Commit: 447b26df0f73a29e19d894663c92fd99e6384420
Parents: 9f9da0e
Author: David Yan <da...@datatorrent.com>
Authored: Mon Sep 19 17:13:22 2016 -0700
Committer: David Yan <da...@datatorrent.com>
Committed: Mon Sep 19 17:13:22 2016 -0700

----------------------------------------------------------------------
 .../lib/state/spillable/WindowBoundedMapCache.java     | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/447b26df/library/src/main/java/org/apache/apex/malhar/lib/state/spillable/WindowBoundedMapCache.java
----------------------------------------------------------------------
diff --git a/library/src/main/java/org/apache/apex/malhar/lib/state/spillable/WindowBoundedMapCache.java b/library/src/main/java/org/apache/apex/malhar/lib/state/spillable/WindowBoundedMapCache.java
index 6db1f1a..0e1d55e 100644
--- a/library/src/main/java/org/apache/apex/malhar/lib/state/spillable/WindowBoundedMapCache.java
+++ b/library/src/main/java/org/apache/apex/malhar/lib/state/spillable/WindowBoundedMapCache.java
@@ -87,15 +87,12 @@ public class WindowBoundedMapCache<K, V>
   public void remove(K key)
   {
     Preconditions.checkNotNull(key);
-
-    if (!cache.containsKey(key)) {
-      return;
-    }
-
-    cache.remove(key);
-    changedKeys.remove(key);
     removedKeys.add(key);
-    priorityQueue.remove(key);
+    if (cache.containsKey(key)) {
+      cache.remove(key);
+      changedKeys.remove(key);
+      priorityQueue.remove(key);
+    }
   }
 
   public Set<K> getChangedKeys()