ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [03/16] ignite git commit: IGNITE-2330: Simplified GridFunc.
Date Mon, 11 Jan 2016 15:34:36 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple3.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple3.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple3.java
index b999e2a..e5d247a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple3.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple3.java
@@ -34,7 +34,6 @@ import org.jetbrains.annotations.Nullable;
  * This class doesn't provide any synchronization for multi-threaded access
  * and it is responsibility of the user of this class to provide outside
  * synchronization, if needed.
- * @see GridFunc#t3()
  * @see GridFunc#t(Object, Object, Object)
  */
 public class GridTuple3<V1, V2, V3> implements Iterable<Object>, Externalizable,
Cloneable {

http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple4.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple4.java
index c95a859..d1e69b5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple4.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple4.java
@@ -34,7 +34,6 @@ import org.jetbrains.annotations.Nullable;
  * This class doesn't provide any synchronization for multi-threaded access
  * and it is responsibility of the user of this class to provide outside
  * synchronization, if needed.
- * @see GridFunc#t4()
  * @see GridFunc#t(Object, Object, Object, Object)
  */
 public class GridTuple4<V1, V2, V3, V4> implements Iterable<Object>, Externalizable,
Cloneable {

http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple5.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple5.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple5.java
index 9790f48..7d25996 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple5.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple5.java
@@ -34,7 +34,6 @@ import org.jetbrains.annotations.Nullable;
  * This class doesn't provide any synchronization for multi-threaded access
  * and it is responsibility of the user of this class to provide outside
  * synchronization, if needed.
- * @see GridFunc#t5()
  * @see GridFunc#t(Object, Object, Object, Object, Object)
  */
 public class GridTuple5<V1, V2, V3, V4, V5> implements Iterable<Object>, Externalizable,
Cloneable {

http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple6.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple6.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple6.java
index 044944b..c904587 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple6.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTuple6.java
@@ -34,7 +34,6 @@ import org.jetbrains.annotations.Nullable;
  * This class doesn't provide any synchronization for multi-threaded access
  * and it is responsibility of the user of this class to provide outside
  * synchronization, if needed.
- * @see GridFunc#t5()
  * @see GridFunc#t(Object, Object, Object, Object, Object)
  */
 public class GridTuple6<V1, V2, V3, V4, V5, V6> implements Iterable<Object>,
Externalizable,

http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java
index 225366a..58e18aa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridTupleV.java
@@ -35,7 +35,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
  * This class doesn't provide any synchronization for multi-threaded access
  * and it is responsibility of the user of this class to provide outside
  * synchronization, if needed.
- * @see GridFunc#tv(Object...)
  */
 public class GridTupleV implements Iterable<Object>, Externalizable, Cloneable {
     /** */

http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
index 5c6bb9a..44ca067 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
@@ -186,7 +186,7 @@ public final class IgniteUuid implements Comparable<IgniteUuid>,
Iterable<Ignite
 
     /** {@inheritDoc} */
     @Override public GridIterator<IgniteUuid> iterator() {
-        return F.iterator(Collections.singleton(this), F.<IgniteUuid>identity(), true);
+        return F.identityIteratorReadOnly(Collections.singleton(this));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpi.java
index c7c635e..56a627a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/eventstorage/memory/MemoryEventStorageSpi.java
@@ -216,6 +216,7 @@ public class MemoryEventStorageSpi extends IgniteSpiAdapter implements
EventStor
     }
 
     /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
     @Override public <T extends Event> Collection<T> localEvents(IgnitePredicate<T>
p) {
         A.notNull(p, "p");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java
index 59a3eca..1e868b7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheLuceneQueryIndexTest.java
@@ -21,6 +21,7 @@ import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.Callable;
+import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
@@ -335,7 +336,8 @@ public class GridCacheLuceneQueryIndexTest extends GridCommonAbstractTest
{
                             map = new HashMap<>();
                         }
 
-                        map.put(new ObjectKey(String.valueOf(i)), F.rand(vals));
+                        map.put(new ObjectKey(String.valueOf(i)),
+                            vals[ThreadLocalRandom.current().nextInt(vals.length)]);
                     }
 
                     if (!map.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
index cb24e54..52737e7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEventAbstractTest.java
@@ -757,7 +757,7 @@ public abstract class GridCacheEventAbstractTest extends GridCacheAbstractSelfTe
             if (TEST_INFO)
                 X.println("Cache event: " + evt.shortDisplay());
 
-            AtomicInteger cntr = F.addIfAbsent(cntrs, evt.type(), F.newAtomicInt());
+            AtomicInteger cntr = F.addIfAbsent(cntrs, evt.type(), new AtomicInteger());
 
             assert cntr != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryCrashDetectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryCrashDetectionSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryCrashDetectionSelfTest.java
index 1aae999..3482fd6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryCrashDetectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/ipc/shmem/IpcSharedMemoryCrashDetectionSelfTest.java
@@ -517,12 +517,16 @@ public class IpcSharedMemoryCrashDetectionSelfTest extends GridCommonAbstractTes
          * @param shmemIds Shared memory IDs string.
          */
         public void shmemIds(String shmemIds) {
-            this.shmemIds = (shmemIds == null) ? null :
-                F.transform(shmemIds.split(","), new C1<String, Integer>() {
-                    @Override public Integer apply(String s) {
-                        return Long.valueOf(s).intValue();
-                    }
-                });
+            if (shmemIds == null)
+                this.shmemIds = null;
+            else {
+                String[] tokens = shmemIds.split(",");
+
+                this.shmemIds = new ArrayList<>(tokens.length);
+
+                for (String token : tokens)
+                    this.shmemIds.add(Long.valueOf(token).intValue());
+            }
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/modules/core/src/test/java/org/apache/ignite/lang/GridBasicPerformanceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/lang/GridBasicPerformanceTest.java
b/modules/core/src/test/java/org/apache/ignite/lang/GridBasicPerformanceTest.java
index 37e7afe..353367e 100644
--- a/modules/core/src/test/java/org/apache/ignite/lang/GridBasicPerformanceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/lang/GridBasicPerformanceTest.java
@@ -748,8 +748,14 @@ public class GridBasicPerformanceTest {
         for (int i = 0; i < MAX; i++) {
             if (sort)
                 Arrays.binarySearch(arr, ThreadLocalRandom8.current().nextInt(lim));
-            else
-                F.contains(arr, ThreadLocalRandom8.current().nextInt(lim));
+            else {
+                int val = ThreadLocalRandom8.current().nextInt(lim);
+
+                for (long arrItem : arr) {
+                    if (arrItem == val)
+                        break;
+                }
+            }
         }
 
         long time =  System.currentTimeMillis() - start;

http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/modules/core/src/test/java/org/apache/ignite/lang/GridFuncPerformanceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/lang/GridFuncPerformanceTest.java
b/modules/core/src/test/java/org/apache/ignite/lang/GridFuncPerformanceTest.java
deleted file mode 100644
index 5afd75f..0000000
--- a/modules/core/src/test/java/org/apache/ignite/lang/GridFuncPerformanceTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.lang;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import org.apache.ignite.internal.util.lang.GridIterator;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.apache.ignite.testframework.junits.common.GridCommonTest;
-
-/**
- * GridFunc performance test.
- */
-@GridCommonTest(group = "Lang")
-public class GridFuncPerformanceTest extends GridCommonAbstractTest {
-    /**
-     *  Creates test.
-     */
-    public GridFuncPerformanceTest() {
-        super(/*start grid*/false);
-    }
-
-    /**
-     *
-     */
-    public void testTransformingIteratorPerformance() {
-        // Warmup.
-        testBody();
-        testBody();
-        testBody();
-
-        long r1 = testBody();
-        long r2 = testBody();
-        long r3 = testBody();
-
-        double r = (r1 + r2 + r3) / 3.f;
-
-        System.out.println("Average result is: " + Math.round(r) + "msec.");
-    }
-
-    /**
-     *
-     * @return Duration of the test.
-     */
-    @SuppressWarnings({"UnusedDeclaration"})
-    private long testBody() {
-        int MAX = 20000000;
-
-        Collection<Integer> l = new ArrayList<>(MAX);
-
-        for (int i = 0; i < MAX / 10; i++)
-            l.add(i);
-
-        IgniteClosure<Integer, Integer> c = new IgniteClosure<Integer, Integer>()
{
-            @Override public Integer apply(Integer e) {
-                return e;
-            }
-        };
-
-        IgnitePredicate<Integer> p1 = new IgnitePredicate<Integer>() {
-            @Override public boolean apply(Integer e) {
-                return e % 2 == 0;
-            }
-        };
-        IgnitePredicate<Integer> p2 = new IgnitePredicate<Integer>() {
-            @Override public boolean apply(Integer e) {
-                return e % 2 != 0;
-            }
-        };
-
-        GridIterator<Integer> iter = F.iterator(l, c, true, p1, p2);
-
-        long n = 0;
-
-        long start = System.currentTimeMillis();
-
-        for (Integer i : iter)
-            n += i;
-
-        long duration = System.currentTimeMillis() - start;
-
-        System.out.println("Duration: " + duration + "msec.");
-
-        return duration;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/modules/core/src/test/java/org/apache/ignite/loadtest/GridLoadTestStatistics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtest/GridLoadTestStatistics.java
b/modules/core/src/test/java/org/apache/ignite/loadtest/GridLoadTestStatistics.java
index 5d517a4..10b140e 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtest/GridLoadTestStatistics.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtest/GridLoadTestStatistics.java
@@ -107,7 +107,7 @@ public class GridLoadTestStatistics {
                     AtomicInteger cnt;
 
                     synchronized (nodeCnts) {
-                        cnt = F.addIfAbsent(nodeCnts, id, F.newAtomicInt());
+                        cnt = F.addIfAbsent(nodeCnts, id, new AtomicInteger());
                     }
 
                     assert cnt != null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/80579253/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