You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by nt...@apache.org on 2016/01/19 11:59:10 UTC
[19/38] ignite git commit: IGNITE-1413 .Net: Get rid of set -> map
conversion in PlatformDotNetCacheStore.writeAll. This closes #380.
IGNITE-1413 .Net: Get rid of set -> map conversion in PlatformDotNetCacheStore.writeAll. This closes #380.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/422272d8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/422272d8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/422272d8
Branch: refs/heads/ignite-gg-10837
Commit: 422272d8298f454ac3d8aa7630799976d83fa664
Parents: 2625129
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Mon Jan 18 12:32:08 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Jan 18 12:32:08 2016 +0300
----------------------------------------------------------------------
.../dotnet/PlatformDotNetCacheStore.java | 33 +++++---------------
.../Impl/Cache/Store/CacheStore.cs | 9 +++++-
2 files changed, 16 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/422272d8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
index 7e65c22..47b1110 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetCacheStore.java
@@ -224,37 +224,20 @@ public class PlatformDotNetCacheStore<K, V> implements CacheStore<K, V>, Platfor
/** {@inheritDoc} */
@SuppressWarnings({"NullableProblems", "unchecked"})
@Override public void writeAll(final Collection<Cache.Entry<? extends K, ? extends V>> entries) {
+ assert entries != null;
try {
doInvoke(new IgniteInClosureX<BinaryRawWriterEx>() {
@Override public void applyx(BinaryRawWriterEx writer) throws IgniteCheckedException {
- Map<K, V> map = new AbstractMap<K, V>() {
- @Override public int size() {
- return entries.size();
- }
-
- @Override public Set<Entry<K, V>> entrySet() {
- return new AbstractSet<Entry<K, V>>() {
- @Override public Iterator<Entry<K, V>> iterator() {
- return F.iterator(entries, new C1<Cache.Entry<? extends K, ? extends V>, Entry<K, V>>() {
- private static final long serialVersionUID = 0L;
-
- @Override public Entry<K, V> apply(Cache.Entry<? extends K, ? extends V> entry) {
- return new GridMapEntry<>(entry.getKey(), entry.getValue());
- }
- }, true);
- }
-
- @Override public int size() {
- return entries.size();
- }
- };
- }
- };
-
writer.writeByte(OP_PUT_ALL);
writer.writeLong(session());
writer.writeString(ses.cacheName());
- writer.writeMap(map);
+
+ writer.writeInt(entries.size());
+
+ for (Cache.Entry<? extends K, ? extends V> e : entries) {
+ writer.writeObject(e.getKey());
+ writer.writeObject(e.getValue());
+ }
}
}, null);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/422272d8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs
index c66eb5e..5aa806b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs
@@ -192,7 +192,14 @@ namespace Apache.Ignite.Core.Impl.Cache.Store
break;
case OpPutAll:
- _store.WriteAll(rawReader.ReadDictionary());
+ var size = rawReader.ReadInt();
+
+ var dict = new Hashtable(size);
+
+ for (int i = 0; i < size; i++)
+ dict[rawReader.ReadObject<object>()] = rawReader.ReadObject<object>();
+
+ _store.WriteAll(dict);
break;