You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2018/03/21 15:54:15 UTC
ignite git commit: ignite-7989 returned cutted ConcurrentHashMap8 for
backward compatibility - Fixes #3663.
Repository: ignite
Updated Branches:
refs/heads/master 18e6aba24 -> ffbc56eef
ignite-7989 returned cutted ConcurrentHashMap8 for backward compatibility - Fixes #3663.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ffbc56ee
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ffbc56ee
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ffbc56ee
Branch: refs/heads/master
Commit: ffbc56eef2fe67ee56e19b4f558ac3d05fe2f39b
Parents: 18e6aba
Author: Anton Kalashnikov <ka...@yandex.ru>
Authored: Wed Mar 21 18:53:15 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Mar 21 18:53:15 2018 +0300
----------------------------------------------------------------------
.../GridDhtPartitionDemandLegacyMessage.java | 22 +++----
.../java/org/jsr166/ConcurrentHashMap8.java | 63 ++++++++++++++++++++
2 files changed, 75 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffbc56ee/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandLegacyMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandLegacyMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandLegacyMessage.java
index a71aabf..46e9ceb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandLegacyMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandLegacyMessage.java
@@ -114,21 +114,23 @@ public class GridDhtPartitionDemandLegacyMessage extends GridCacheGroupIdMessage
workerId = cp.workerId();
topVer = cp.topologyVersion();
- parts = new HashSet<>(cp.partitions().size());
+ if(!cp.partitions().isEmpty()) {
+ parts = new HashSet<>(cp.partitions().size());
- parts.addAll(cp.partitions().fullSet());
+ parts.addAll(cp.partitions().fullSet());
- CachePartitionPartialCountersMap histMap = cp.partitions().historicalMap();
+ CachePartitionPartialCountersMap histMap = cp.partitions().historicalMap();
- if (!histMap.isEmpty()) {
- historicalParts = new HashSet<>(histMap.size());
+ if (!histMap.isEmpty()) {
+ historicalParts = new HashSet<>(histMap.size());
- for (int i = 0; i < histMap.size(); i++) {
- int p = histMap.partitionAt(i);
+ for (int i = 0; i < histMap.size(); i++) {
+ int p = histMap.partitionAt(i);
- parts.add(p);
- historicalParts.add(p);
- partsCntrs.put(p, histMap.updateCounterAt(i));
+ parts.add(p);
+ historicalParts.add(p);
+ partsCntrs.put(p, histMap.updateCounterAt(i));
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ffbc56ee/modules/core/src/main/java/org/jsr166/ConcurrentHashMap8.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/jsr166/ConcurrentHashMap8.java b/modules/core/src/main/java/org/jsr166/ConcurrentHashMap8.java
new file mode 100644
index 0000000..ad38478
--- /dev/null
+++ b/modules/core/src/main/java/org/jsr166/ConcurrentHashMap8.java
@@ -0,0 +1,63 @@
+/*
+ * Written by Doug Lea with assistance from members of JCP JSR-166
+ * Expert Group and released to the public domain, as explained at
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+/*
+ * The latest version of the file was copied from the following CVS repository:
+ * http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/
+ *
+ * Corresponding commit version in CVS repository is unknown (lost on our side).
+ * On the other hand we can't simply synch the latest version from CVS here, because Ignite uses functionality that
+ * is no longer supported.
+ */
+
+package org.jsr166;
+
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * This class use only for deserialization. In code use ConcurrentHashMap.
+ *
+ * @deprecated need for java deserialization ConcurrentHashMap8 from old nodes.
+ */
+@Deprecated
+@SuppressWarnings("ALL")
+public class ConcurrentHashMap8<K, V> implements Serializable {
+ private static final long serialVersionUID = 7249069246763182397L;
+
+ private Map<K, V> actualMap;
+
+ /**
+ * Reconstitutes the instance from a stream (that is, deserializes it).
+ *
+ * @param s the stream
+ */
+ @SuppressWarnings("unchecked") private void readObject(java.io.ObjectInputStream s)
+ throws java.io.IOException, ClassNotFoundException {
+ s.defaultReadObject();
+
+ actualMap = new ConcurrentHashMap<>();
+ for (; ; ) {
+ K k = (K)s.readObject();
+ V v = (V)s.readObject();
+
+ if (k != null && v != null) {
+ actualMap.put(k, v);
+ }
+ else
+ break;
+ }
+ }
+
+ /**
+ * @return ConcurrentHashMap instead ConcurrentHashMap8 for using in code.
+ */
+ Object readResolve() throws ObjectStreamException {
+ return actualMap;
+ }
+}