#ignite-286: small refactoring.

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

Branch: refs/heads/ignite-286
Commit: 529db757dcd31d7854968862fbaf6d8832b041d6
Parents: 9b5f9b5
Author: ivasilinets <[email protected]>
Authored: Mon Apr 27 17:02:43 2015 +0300
Committer: ivasilinets <[email protected]>
Committed: Mon Apr 27 17:02:43 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheSwapManager.java      | 10 ----------
 .../cache/query/GridCacheQueryManager.java          | 16 +++++++++-------
 2 files changed, 9 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/529db757/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index cd8a0c7..6fd5d64 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -1614,16 +1614,6 @@ public class GridCacheSwapManager extends 
GridCacheManagerAdapter {
 
         return new int[0];
     }
-    /**
-     * @param part Partition.
-     * @return Raw off-heap iterator.
-     */
-    public GridCloseableIterator<Map.Entry<byte[], byte[]>> 
rawOffHeapIterator(final int part) {
-        if (!offheapEnabled)
-            return new GridEmptyCloseableIterator<>();
-
-        return new OffHeapIterator(offheap.iterator(spaceName, new 
int[]{part}));
-    }
 
     /**
      * Gets swap space iterator over partition.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/529db757/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 172a451..1aac877 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -774,7 +774,9 @@ public abstract class GridCacheQueryManager<K, V> extends 
GridCacheManagerAdapte
 
         final ExpiryPolicy plc = cctx.expiry();
 
-        Set<Integer> parts = qry.includeBackups() || cctx.isReplicated() ? 
null :
+        final boolean includeBackups = qry.includeBackups() || 
cctx.isReplicated();
+
+        Set<Integer> parts = includeBackups ? null :
             cctx.affinity().primaryPartitions(cctx.nodeId(), 
cctx.affinity().affinityTopologyVersion());
 
         final GridCloseableIteratorAdapter<IgniteBiTuple<K, V>> heapIt = new 
GridCloseableIteratorAdapter<IgniteBiTuple<K, V>>() {
@@ -782,7 +784,7 @@ public abstract class GridCacheQueryManager<K, V> extends 
GridCacheManagerAdapte
 
             private IgniteCacheExpiryPolicy expiryPlc = 
cctx.cache().expiryPolicy(plc);
 
-            private Iterator<K> iter = qry.includeBackups() || 
cctx.isReplicated() ?
+            private Iterator<K> iter = includeBackups ?
                 prj.keySet().iterator() : prj.primaryKeySet().iterator();
 
             {
@@ -879,7 +881,7 @@ public abstract class GridCacheQueryManager<K, V> extends 
GridCacheManagerAdapte
             iters.add(heapIt);
 
             if (cctx.isOffHeapEnabled())
-                iters.add(offheapIterator(qry, parts));
+                iters.add(offheapIterator(qry, includeBackups));
 
             if (cctx.swap().swapEnabled())
                 iters.add(swapIterator(qry, parts));
@@ -942,21 +944,21 @@ public abstract class GridCacheQueryManager<K, V> extends 
GridCacheManagerAdapte
 
     /**
      * @param qry Query.
-     * @param parts Collection of partitions.
+     * @param includeBackups IncludeBackups.
      * @return Offheap iterator.
      * @throws IgniteCheckedException If failed.
      */
-    private GridIterator<IgniteBiTuple<K, V>> 
offheapIterator(GridCacheQueryAdapter<?> qry, Collection<Integer> parts)
+    private GridIterator<IgniteBiTuple<K, V>> 
offheapIterator(GridCacheQueryAdapter<?> qry, boolean includeBackups)
         throws IgniteCheckedException {
         IgniteBiPredicate<K, V> filter = qry.scanFilter();
 
         if (cctx.offheapTiered() && filter != null) {
             OffheapIteratorClosure c = new OffheapIteratorClosure(filter, 
qry.keepPortable());
 
-            return cctx.swap().rawOffHeapIterator(c, true, parts == null);
+            return cctx.swap().rawOffHeapIterator(c, true, includeBackups);
         }
         else {
-            Iterator<Map.Entry<byte[], byte[]>> it = 
cctx.swap().rawOffHeapIterator(true, parts == null);
+            Iterator<Map.Entry<byte[], byte[]>> it = 
cctx.swap().rawOffHeapIterator(true, includeBackups);
 
             return scanIterator(it, filter, qry.keepPortable());
         }

Reply via email to