You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/09/15 04:00:00 UTC

[6/6] ignite git commit: IGNITE-1400 - Reverted fix.

IGNITE-1400 - Reverted fix.


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

Branch: refs/heads/ignite-1400
Commit: bc32ad7f5ddc46bc9b182c2e6ae5b93d5840babe
Parents: 5082374
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Sep 14 18:59:35 2015 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Sep 14 18:59:35 2015 -0700

----------------------------------------------------------------------
 .../distributed/dht/GridDhtLocalPartition.java  | 62 ++++++--------------
 1 file changed, 19 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bc32ad7f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index a58451f..c5f15cd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -708,62 +708,38 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
 
         return new Iterator<GridDhtCacheEntry>() {
             /** */
-            private GridDhtCacheEntry lastEntry;
+            GridDhtCacheEntry lastEntry;
 
-            {
-                lastEntry = advance();
+            @Override public boolean hasNext() {
+                return it.hasNext();
             }
 
-            private GridDhtCacheEntry advance() {
-                if (it.hasNext()) {
-                    Map.Entry<byte[], GridCacheSwapEntry> entry = it.next();
-
-                    byte[] keyBytes = entry.getKey();
+            @Override public GridDhtCacheEntry next() {
+                Map.Entry<byte[], GridCacheSwapEntry> entry = it.next();
 
-                    while (true) {
-                        try {
-                            KeyCacheObject key = cctx.toCacheKeyObject(keyBytes);
+                byte[] keyBytes = entry.getKey();
 
-                            lastEntry = (GridDhtCacheEntry)cctx.cache().entryEx(key, false);
+                while (true) {
+                    try {
+                        KeyCacheObject key = cctx.toCacheKeyObject(keyBytes);
 
-                            lastEntry.unswap(true);
+                        lastEntry = (GridDhtCacheEntry)cctx.cache().entryEx(key, false);
 
-                            return lastEntry;
-                        }
-                        catch (GridCacheEntryRemovedException e) {
-                            if (log.isDebugEnabled())
-                                log.debug("Got removed entry: " + lastEntry);
-                        }
-                        catch (IgniteCheckedException e) {
-                            throw new CacheException(e);
-                        }
-                        catch (GridDhtInvalidPartitionException e) {
-                            if (log.isDebugEnabled())
-                                log.debug("Got invalid partition exception: " + e);
+                        lastEntry.unswap(true);
 
-                            return null;
-                        }
+                        return lastEntry;
+                    }
+                    catch (GridCacheEntryRemovedException e) {
+                        if (log.isDebugEnabled())
+                            log.debug("Got removed entry: " + lastEntry);
+                    }
+                    catch (IgniteCheckedException e) {
+                        throw new CacheException(e);
                     }
                 }
-
-                return null;
-            }
-
-            @Override public boolean hasNext() {
-                return lastEntry != null;
-            }
-
-            @Override public GridDhtCacheEntry next() {
-                if (lastEntry == null)
-                    throw new NoSuchElementException();
-
-                return lastEntry;
             }
 
             @Override public void remove() {
-                if (lastEntry == null)
-                    throw new NoSuchElementException();
-
                 map.remove(lastEntry.key(), lastEntry);
             }
         };