Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-sprint-4-tests 18c3d93bb -> b1db63542


#ignite-sprint-4-tests: debug query tests.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/b1db6354
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b1db6354
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b1db6354

Branch: refs/heads/ignite-sprint-4-tests
Commit: b1db63542430b607cb4a885e9db22f506ab89f34
Parents: 18c3d93
Author: ivasilinets <ivasilin...@gridgain.com>
Authored: Tue Apr 21 11:02:48 2015 +0300
Committer: ivasilinets <ivasilin...@gridgain.com>
Committed: Tue Apr 21 11:02:48 2015 +0300

----------------------------------------------------------------------
 .../cache/GridCacheEvictionManager.java         | 22 +++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b1db6354/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
index 2009587..1762ccc 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionManager.java
@@ -915,6 +915,8 @@ public class GridCacheEvictionManager extends 
GridCacheManagerAdapter {
 
         List<GridCacheEntryEx> locked = new ArrayList<>(keys.size());
 
+        List<GridCacheEntryEx> toRemove = new ArrayList<>(keys.size());
+
         Collection<GridCacheBatchSwapEntry> swapped = new 
ArrayList<>(keys.size());
 
         boolean recordable = 
cctx.events().isRecordable(EVT_CACHE_ENTRY_EVICTED);
@@ -944,6 +946,10 @@ public class GridCacheEvictionManager extends 
GridCacheManagerAdapter {
 
                 locked.add(entry);
 
+                if (!entry.obsolete()) {
+                    toRemove.add(entry);
+                }
+
                 if (obsoleteVer == null)
                     obsoleteVer = cctx.versions().next();
 
@@ -962,8 +968,15 @@ public class GridCacheEvictionManager extends 
GridCacheManagerAdapter {
                 cctx.swap().writeAll(swapped);
         }
         finally {
+            // Unlock entries in reverse order.
+            for (ListIterator<GridCacheEntryEx> it = 
locked.listIterator(locked.size()); it.hasPrevious();) {
+                GridCacheEntryEx e = it.previous();
+
+                unsafe.monitorExit(e);
+            }
+
             // Remove entries and fire events outside the locks.
-            for (GridCacheEntryEx entry : locked) {
+            for (GridCacheEntryEx entry : toRemove) {
                 if (entry.obsolete()) {
                     entry.onMarkedObsolete();
 
@@ -977,13 +990,6 @@ public class GridCacheEvictionManager extends 
GridCacheManagerAdapter {
                             EVT_CACHE_ENTRY_EVICTED, null, false, 
entry.rawGet(), entry.hasValue(), null, null, null);
                 }
             }
-
-            // Unlock entries in reverse order.
-            for (ListIterator<GridCacheEntryEx> it = 
locked.listIterator(locked.size()); it.hasPrevious();) {
-                GridCacheEntryEx e = it.previous();
-
-                unsafe.monitorExit(e);
-            }
         }
     }
 

Reply via email to