ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [7/8] ignite git commit: IGNITE-2263: Reworked "F.emptyIterator()" routine.
Date Wed, 30 Dec 2015 09:52:26 GMT
IGNITE-2263: Reworked "F.emptyIterator()" routine.


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

Branch: refs/heads/ignite-2263
Commit: 024bead1408003e2b13c65c63d886c4df49c4252
Parents: 94cf22b
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Wed Dec 30 12:50:45 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Wed Dec 30 12:50:45 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/GridCacheSwapManager.java       | 7 +++----
 .../ignite/internal/processors/cache/IgniteCacheProxy.java    | 4 ++--
 .../java/org/apache/ignite/internal/util/lang/GridFunc.java   | 6 ++++--
 .../internal/processors/query/h2/opt/GridH2TreeIndex.java     | 4 ++--
 4 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/024bead1/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 37b5e15..4490f63 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
@@ -42,7 +42,6 @@ import org.apache.ignite.internal.processors.offheap.GridOffHeapProcessor;
 import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
 import org.apache.ignite.internal.util.GridConcurrentHashSet;
 import org.apache.ignite.internal.util.GridEmptyCloseableIterator;
-import org.apache.ignite.internal.util.GridEmptyIterator;
 import org.apache.ignite.internal.util.GridWeakIterator;
 import org.apache.ignite.internal.util.lang.GridCloseableIterator;
 import org.apache.ignite.internal.util.lang.GridTuple;
@@ -1581,7 +1580,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
      */
     public <K, V> Iterator<Map.Entry<K, V>> lazySwapIterator() throws IgniteCheckedException
{
         if (!swapEnabled)
-            return new GridEmptyIterator<>();
+            return F.emptyIterator();
 
         return lazyIterator(cctx.gridSwap().rawIterator(spaceName));
     }
@@ -1672,7 +1671,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     private <K, V> Iterator<Map.Entry<K, V>> lazyIterator(
         final GridCloseableIterator<? extends Map.Entry<byte[], byte[]>> it)
{
         if (it == null)
-            return new GridEmptyIterator<>();
+            return F.emptyIterator();
 
         checkIteratorQueue();
 
@@ -1743,7 +1742,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
     private Iterator<KeyCacheObject> keyIterator(
         final GridCloseableIterator<? extends Map.Entry<byte[], byte[]>> it)
{
         if (it == null)
-            return new GridEmptyIterator<>();
+            return F.emptyIterator();
 
         checkIteratorQueue();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/024bead1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 27a7587..a6e0ea8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -69,7 +69,6 @@ import org.apache.ignite.internal.processors.cache.query.CacheQuery;
 import org.apache.ignite.internal.processors.cache.query.CacheQueryFuture;
 import org.apache.ignite.internal.processors.query.GridQueryProcessor;
 import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
-import org.apache.ignite.internal.util.GridEmptyIterator;
 import org.apache.ignite.internal.util.future.IgniteFutureImpl;
 import org.apache.ignite.internal.util.lang.GridClosureException;
 import org.apache.ignite.internal.util.lang.IgniteOutClosureX;
@@ -77,6 +76,7 @@ import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.CI1;
 import org.apache.ignite.internal.util.typedef.CX1;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
@@ -579,7 +579,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K,
V
 
             return new QueryCursor<Cache.Entry<K, V>>() {
                 @Override public Iterator<Cache.Entry<K, V>> iterator() {
-                    return cur != null ? cur.iterator() : new GridEmptyIterator<Cache.Entry<K,
V>>();
+                    return cur != null ? cur.iterator() : F.<Cache.Entry<K, V>>emptyIterator();
                 }
 
                 @Override public List<Cache.Entry<K, V>> getAll() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/024bead1/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
index 47c90c3..9592e19 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java
@@ -37,7 +37,6 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
-import javax.cache.Cache;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.compute.ComputeJobResult;
 import org.apache.ignite.internal.util.F0;
@@ -226,6 +225,9 @@ public class GridFunc {
         }
     };
 
+    /** Empty iterator. */
+    private static final GridEmptyIterator EMPTY_ITER = new GridEmptyIterator();
+
     /**
      * Gets predicate that evaluates to {@code true} only for given local node ID.
      *
@@ -1153,7 +1155,7 @@ public class GridFunc {
      * @return Newly created empty iterator.
      */
     public static <T> GridIterator<T> emptyIterator() {
-        return new GridEmptyIterator<>();
+        return EMPTY_ITER;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/024bead1/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
index 28adeee..9582df0 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
@@ -24,10 +24,10 @@ import java.util.Iterator;
 import java.util.NavigableMap;
 import java.util.concurrent.ConcurrentNavigableMap;
 import java.util.concurrent.ConcurrentSkipListMap;
-import org.apache.ignite.internal.util.GridEmptyIterator;
 import org.apache.ignite.internal.util.offheap.unsafe.GridOffHeapSnapTreeMap;
 import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeGuard;
 import org.apache.ignite.internal.util.snaptree.SnapTreeMap;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.indexing.IndexingQueryFilter;
@@ -319,7 +319,7 @@ public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridS
             comparable(last, 1));
 
         if (range == null)
-            return new GridEmptyIterator<>();
+            return F.emptyIterator();
 
         return filter(range.values().iterator());
     }


Mime
View raw message