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 2016/04/01 11:14:34 UTC
ignite git commit: 4 more deprecations.
Repository: ignite
Updated Branches:
refs/heads/ignite-2934 9a6b3d51b -> b6a0078a9
4 more deprecations.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b6a0078a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b6a0078a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b6a0078a
Branch: refs/heads/ignite-2934
Commit: b6a0078a94f436e9914cc6ed6eaf733179423631
Parents: 9a6b3d5
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Apr 1 12:14:29 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Apr 1 12:14:29 2016 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheSwapManager.java | 8 +++---
.../GridDhtPartitionsExchangeFuture.java | 27 ++++++++++++++++++--
.../cache/query/GridCacheQueryManager.java | 3 ++-
.../store/GridCacheStoreManagerAdapter.java | 4 +--
.../service/GridServiceProcessor.java | 3 ++-
.../ignite/internal/util/lang/GridFunc.java | 4 +++
.../ignite/spi/discovery/tcp/ServerImpl.java | 17 ++++++++++--
7 files changed, 54 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a0078a/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 1808289..7901105 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
@@ -1620,7 +1620,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
assert primary || backup;
if (!offheapEnabled)
- return F.emptyIterator();
+ return new GridEmptyIterator<>();
if (primary && backup)
return keyIterator(offheap.iterator(spaceName));
@@ -1645,7 +1645,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
assert primary || backup;
if (!swapEnabled)
- return F.emptyIterator();
+ return new GridEmptyIterator<>();
if (primary && backup)
return keyIterator(cctx.gridSwap().rawIterator(spaceName));
@@ -2044,7 +2044,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
assert primary || backup;
if (!swapEnabled)
- return F.emptyIterator();
+ return new GridEmptyIterator<>();
if (primary && backup)
return cacheEntryIterator(this.<K, V>lazySwapIterator());
@@ -2076,7 +2076,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
assert primary || backup;
if (!offheapEnabled)
- return F.emptyIterator();
+ return new GridEmptyIterator<>();
if (primary && backup)
return cacheEntryIterator(this.<K, V>lazyOffHeapIterator());
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a0078a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 68a05e4..d52ad72 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -1611,8 +1611,8 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
try {
U.warn(log,
"Retrying preload partition exchange due to timeout [done=" + isDone() +
- ", dummy=" + dummy + ", exchId=" + exchId + ", rcvdIds=" + F.id8s(rcvdIds) +
- ", rmtIds=" + F.id8s(rmtIds) + ", remaining=" + F.id8s(remaining()) +
+ ", dummy=" + dummy + ", exchId=" + exchId + ", rcvdIds=" + id8s(rcvdIds) +
+ ", rmtIds=" + id8s(rmtIds) + ", remaining=" + id8s(remaining()) +
", init=" + init + ", initFut=" + initFut.isDone() +
", ready=" + ready + ", replied=" + replied + ", added=" + added +
", oldest=" + U.id8(oldestNode.get().id()) + ", oldestOrder=" +
@@ -1647,6 +1647,29 @@ public class GridDhtPartitionsExchangeFuture extends GridFutureAdapter<AffinityT
return F.lose(rmtIds, true, rcvdIds);
}
+ /**
+ * Convenient utility method that returns collection of node ID8s for a given
+ * collection of node IDs. ID8 is a shorter string representation of node ID,
+ * mainly the first 8 characters.
+ * <p>
+ * Note that this method doesn't create a new collection but simply iterates
+ * over the input one.
+ *
+ * @param ids Collection of nodeIds.
+ * @return Collection of node IDs for given collection of grid nodes.
+ */
+ private static Collection<String> id8s(@Nullable Collection<UUID> ids) {
+ if (ids == null || ids.isEmpty())
+ return Collections.emptyList();
+
+ Collection<String> res = new ArrayList<>(ids.size());
+
+ for (UUID id : ids)
+ res.add(U.id8(id));
+
+ return res;
+ }
+
/** {@inheritDoc} */
@Override public int compareTo(GridDhtPartitionsExchangeFuture fut) {
return exchId.compareTo(fut.exchId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a0078a/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 1bdab8f..401b61b 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
@@ -81,6 +81,7 @@ import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.GridCloseableIteratorAdapter;
import org.apache.ignite.internal.util.GridEmptyCloseableIterator;
+import org.apache.ignite.internal.util.GridEmptyIterator;
import org.apache.ignite.internal.util.GridLeanMap;
import org.apache.ignite.internal.util.GridSpiCloseableIteratorWrapper;
import org.apache.ignite.internal.util.GridSpinBusyLock;
@@ -831,7 +832,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
if (part == null || cctx.isLocal())
keyIter = backups ? prj.keySetx().iterator() : prj.primaryKeySet().iterator();
else if (part < 0 || part >= cctx.affinity().partitions())
- keyIter = F.emptyIterator();
+ keyIter = new GridEmptyIterator<>();
else {
final GridDhtCacheAdapter dht = cctx.isNear() ? cctx.near().dht() : cctx.dht();
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a0078a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
index 7ffebbd..467f4b9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java
@@ -44,6 +44,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.GridEmptyIterator;
import org.apache.ignite.internal.util.GridLeanMap;
import org.apache.ignite.internal.util.GridSetWrapper;
import org.apache.ignite.internal.util.lang.GridInClosure3;
@@ -60,7 +61,6 @@ import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiInClosure;
import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.transactions.Transaction;
import org.jetbrains.annotations.NotNull;
@@ -1064,7 +1064,7 @@ public abstract class GridCacheStoreManagerAdapter extends GridCacheManagerAdapt
/** {@inheritDoc} */
@NotNull @Override public Iterator<Cache.Entry<?, ?>> iterator() {
if (cleared)
- return F.emptyIterator();
+ return new GridEmptyIterator<>();
final Iterator<Map.Entry<?, IgniteBiTuple<?, GridCacheVersion>>> it0 = (Iterator)map.entrySet().iterator();
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a0078a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index 2d8488b..e58b862 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -62,6 +62,7 @@ import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
+import org.apache.ignite.internal.util.GridEmptyIterator;
import org.apache.ignite.internal.util.GridSpinBusyLock;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
@@ -1073,7 +1074,7 @@ public class GridServiceProcessor extends GridProcessorAdapter {
CU.oldestAliveCacheServerNode(cache.context().shared(), AffinityTopologyVersion.NONE);
if (oldestSrvNode == null)
- return F.emptyIterator();
+ return new GridEmptyIterator<>();
GridCacheQueryManager qryMgr = cache.context().queries();
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a0078a/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 f02e810..7551b0e 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
@@ -641,6 +641,7 @@ public class GridFunc {
* @param ids Collection of nodeIds.
* @return Collection of node IDs for given collection of grid nodes.
*/
+ @Deprecated
public static Collection<String> id8s(@Nullable Collection<UUID> ids) {
if (ids == null || ids.isEmpty())
return Collections.emptyList();
@@ -694,6 +695,7 @@ public class GridFunc {
* @param <T> Type of the list elements.
* @return Random value from the input list.
*/
+ @Deprecated
public static <T> T rand(List<T> l) {
A.notNull(l, "l");
@@ -1417,6 +1419,7 @@ public class GridFunc {
* @param <T> Type of the iterator.
* @return Newly created empty iterator.
*/
+ @Deprecated
public static <T> GridIterator<T> emptyIterator() {
return new GridEmptyIterator<>();
}
@@ -3372,6 +3375,7 @@ public class GridFunc {
* @return Resulting collection.
*/
@SuppressWarnings("unchecked")
+ @Deprecated
public static <T extends R, R> Collection<R> upcast(Collection<T> c) {
A.notNull(c, "c");
http://git-wip-us.apache.org/repos/asf/ignite/blob/b6a0078a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index fe2bbce..6b7710e 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -81,6 +81,7 @@ import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.P1;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -271,7 +272,7 @@ class ServerImpl extends TcpDiscoveryImpl {
/** {@inheritDoc} */
@Override public Collection<ClusterNode> getRemoteNodes() {
- return F.upcast(ring.visibleRemoteNodes());
+ return upcast(ring.visibleRemoteNodes());
}
/** {@inheritDoc} */
@@ -1277,7 +1278,7 @@ class ServerImpl extends TcpDiscoveryImpl {
log.debug("Discovery notification [node=" + node + ", spiState=" + spiState +
", type=" + U.gridEventName(type) + ", topVer=" + topVer + ']');
- Collection<ClusterNode> top = F.upcast(ring.visibleNodes());
+ Collection<ClusterNode> top = upcast(ring.visibleNodes());
Map<Long, Collection<ClusterNode>> hist = updateTopologyHistory(topVer, top);
@@ -1291,6 +1292,18 @@ class ServerImpl extends TcpDiscoveryImpl {
}
/**
+ * Upcasts collection type.
+ *
+ * @param c Initial collection.
+ * @return Resulting collection.
+ */
+ private static <T extends R, R> Collection<R> upcast(Collection<T> c) {
+ A.notNull(c, "c");
+
+ return (Collection<R>)c;
+ }
+
+ /**
* Update topology history with new topology snapshots.
*
* @param topVer Topology version.