You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/12/29 15:18:49 UTC
ignite git commit: IGNITE-2263: Further simplification of GridFunc.
Repository: ignite
Updated Branches:
refs/heads/ignite-2263 597ef1d6e -> ef26b779f
IGNITE-2263: Further simplification of GridFunc.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ef26b779
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ef26b779
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ef26b779
Branch: refs/heads/ignite-2263
Commit: ef26b779fcc6c50d2d399eb6f3223880d83d6e47
Parents: 597ef1d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Dec 29 17:10:27 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Dec 29 17:10:27 2015 +0300
----------------------------------------------------------------------
.../internal/util/GridExecutionStatistics.java | 4 +-
.../ignite/internal/util/lang/GridFunc.java | 123 -------------------
.../distributed/GridCacheEventAbstractTest.java | 2 +-
.../ignite/loadtest/GridLoadTestStatistics.java | 2 +-
4 files changed, 4 insertions(+), 127 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ef26b779/modules/core/src/main/java/org/apache/ignite/internal/util/GridExecutionStatistics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/GridExecutionStatistics.java b/modules/core/src/main/java/org/apache/ignite/internal/util/GridExecutionStatistics.java
index a23fe28..fc2e3a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/GridExecutionStatistics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/GridExecutionStatistics.java
@@ -71,13 +71,13 @@ public class GridExecutionStatistics {
long time = startTime.get().get2();
- AtomicInteger cnt = F.addIfAbsent(cntMap, name, F.newAtomicInt());
+ AtomicInteger cnt = F.addIfAbsent(cntMap, name, new AtomicInteger());
assert cnt != null;
cnt.incrementAndGet();
- AtomicLong d = F.addIfAbsent(durationMap, name, F.newAtomicLong());
+ AtomicLong d = F.addIfAbsent(durationMap, name, new AtomicLong());
assert d != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/ef26b779/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 4cba715..72a907b 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
@@ -35,13 +35,11 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicBoolean;
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.IgniteInternalFuture;
import org.apache.ignite.internal.util.F0;
import org.apache.ignite.internal.util.GridConcurrentHashSet;
import org.apache.ignite.internal.util.GridEmptyIterator;
@@ -163,28 +161,6 @@ public class GridFunc {
};
/** */
- private static final IgniteCallable<?> LIST_FACTORY = new IgniteCallable<List>() {
- @Override public List call() {
- return new ArrayList();
- }
-
- @Override public String toString() {
- return "Array list factory.";
- }
- };
-
- /** */
- private static final IgniteCallable<?> LINKED_LIST_FACTORY = new IgniteCallable<LinkedList>() {
- @Override public LinkedList call() {
- return new LinkedList();
- }
-
- @Override public String toString() {
- return "Linked list factory.";
- }
- };
-
- /** */
private static final IgniteCallable<?> SET_FACTORY = new IgniteCallable<Set>() {
@Override public Set call() {
return new HashSet();
@@ -196,50 +172,6 @@ public class GridFunc {
};
/** */
- private static final IgniteCallable<AtomicInteger> ATOMIC_INT_FACTORY = new IgniteCallable<AtomicInteger>() {
- @Override public AtomicInteger call() {
- return new AtomicInteger(0);
- }
-
- @Override public String toString() {
- return "Atomic integer factory.";
- }
- };
-
- /** */
- private static final IgniteCallable<AtomicLong> ATOMIC_LONG_FACTORY = new IgniteCallable<AtomicLong>() {
- @Override public AtomicLong call() {
- return new AtomicLong(0);
- }
-
- @Override public String toString() {
- return "Atomic long factory.";
- }
- };
-
- /** */
- private static final IgniteCallable<AtomicBoolean> ATOMIC_BOOL_FACTORY = new IgniteCallable<AtomicBoolean>() {
- @Override public AtomicBoolean call() {
- return new AtomicBoolean();
- }
-
- @Override public String toString() {
- return "Atomic boolean factory.";
- }
- };
-
- /** */
- private static final IgniteCallable<?> MAP_FACTORY = new IgniteCallable<Map>() {
- @Override public Map call() {
- return new HashMap();
- }
-
- @Override public String toString() {
- return "Hash map factory.";
- }
- };
-
- /** */
private static final IgniteCallable<?> CONCURRENT_MAP_FACTORY = new IgniteCallable<ConcurrentMap>() {
@Override public ConcurrentMap call() {
return new ConcurrentHashMap8();
@@ -2107,43 +2039,6 @@ public class GridFunc {
}
/**
- * Returns a factory closure that creates new {@link List} instance. Note that this
- * method does not create a new closure but returns a static one.
- *
- * @param <T> Type parameters for the created {@link List}.
- * @return Factory closure that creates new {@link List} instance every
- * time its {@link org.apache.ignite.lang.IgniteOutClosure#apply()} method is called.
- */
- @SuppressWarnings("unchecked")
- public static <T> IgniteCallable<List<T>> newList() {
- return (IgniteCallable<List<T>>)LIST_FACTORY;
- }
-
- /**
- * Returns a factory closure that creates new {@link AtomicInteger} instance
- * initialized to {@code zero}. Note that this method does not create a new
- * closure but returns a static one.
- *
- * @return Factory closure that creates new {@link AtomicInteger} instance
- * initialized to {@code zero} every time its {@link org.apache.ignite.lang.IgniteOutClosure#apply()} method is called.
- */
- public static IgniteCallable<AtomicInteger> newAtomicInt() {
- return ATOMIC_INT_FACTORY;
- }
-
- /**
- * Returns a factory closure that creates new {@link AtomicLong} instance
- * initialized to {@code zero}. Note that this method does not create a new
- * closure but returns a static one.
- *
- * @return Factory closure that creates new {@link AtomicLong} instance
- * initialized to {@code zero} every time its {@link org.apache.ignite.lang.IgniteOutClosure#apply()} method is called.
- */
- public static IgniteCallable<AtomicLong> newAtomicLong() {
- return ATOMIC_LONG_FACTORY;
- }
-
- /**
* Returns a factory closure that creates new {@link Set} instance. Note that this
* method does not create a new closure but returns a static one.
*
@@ -2157,20 +2052,6 @@ public class GridFunc {
}
/**
- * Returns a factory closure that creates new {@link Map} instance. Note
- * that this method does not create a new closure but returns a static one.
- *
- * @param <K> Type of the key for the created {@link Map}.
- * @param <V> Type of the value for the created {@link Map}.
- * @return Factory closure that creates new {@link Map} instance every
- * time its {@link org.apache.ignite.lang.IgniteOutClosure#apply()} method is called.
- */
- @SuppressWarnings("unchecked")
- public static <K, V> IgniteCallable<Map<K, V>> newMap() {
- return (IgniteCallable<Map<K, V>>)MAP_FACTORY;
- }
-
- /**
* Returns a factory closure that creates new {@link ConcurrentMap} instance.
* Note that this method does not create a new closure but returns a static one.
*
@@ -2874,11 +2755,7 @@ public class GridFunc {
* found (or {@code null} if key is not found and closure is not provided). Note that
* in case when key is not found the default value will be put into the map.
* @throws GridClosureException Thrown in case when callable throws exception.
- * @see #newList()
* @see #newSet()
- * @see #newMap()
- * @see #newAtomicLong()
- * @see #newAtomicInt()
*/
@Nullable public static <K, V> V addIfAbsent(Map<? super K, V> map, @Nullable K key,
@Nullable Callable<? extends V> c) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ef26b779/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/ef26b779/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;