Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B0D65200B6B for ; Fri, 9 Sep 2016 12:09:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AE438160AC2; Fri, 9 Sep 2016 10:09:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D1F95160AB6 for ; Fri, 9 Sep 2016 12:09:04 +0200 (CEST) Received: (qmail 63378 invoked by uid 500); 9 Sep 2016 10:09:03 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 63369 invoked by uid 99); 9 Sep 2016 10:09:03 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Sep 2016 10:09:03 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6AF3FDFE80; Fri, 9 Sep 2016 10:09:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ptupitsyn@apache.org To: commits@ignite.apache.org Message-Id: <92a197f53acb4819943e88c50232ecdc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ignite git commit: Refactoring data exchange Date: Fri, 9 Sep 2016 10:09:03 +0000 (UTC) archived-at: Fri, 09 Sep 2016 10:09:05 -0000 Repository: ignite Updated Branches: refs/heads/ignite-3199-1 a7ff62424 -> 930b73eb1 Refactoring data exchange Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/930b73eb Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/930b73eb Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/930b73eb Branch: refs/heads/ignite-3199-1 Commit: 930b73eb17bac14243ae3c3d48fc7b838b4a1cb9 Parents: a7ff624 Author: Pavel Tupitsyn Authored: Fri Sep 9 13:08:51 2016 +0300 Committer: Pavel Tupitsyn Committed: Fri Sep 9 13:08:51 2016 +0300 ---------------------------------------------------------------------- .../platform/cache/PlatformCacheInvoker.java | 25 ++++-------- .../websession/PlatformDotnetSessionData.java | 42 ++++++++++++++------ .../IgniteSessionStateStoreProvider.cs | 10 +---- .../Impl/Binary/Marshaller.cs | 4 +- 4 files changed, 42 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/930b73eb/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java index 74b7983..6962359 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java @@ -66,29 +66,20 @@ public class PlatformCacheInvoker { } case OP_SESSION_SET_AND_UNLOCK: - UUID lockNodeId = reader.readUuid(); - long lockId = reader.readLong(); - PlatformDotnetSessionSetAndUnlockProcessor proc; if (reader.readBoolean()) { - boolean isDiff = !reader.readBoolean(); - - int count = reader.readInt(); - - Map entries = new TreeMap<>(); + PlatformDotnetSessionData data = reader.readObject(); - for (int i = 0; i < count; i++) - entries.put(reader.readString(), reader.readByteArray()); - - byte[] staticData = reader.readByteArray(); - int timeout = reader.readInt(); - - proc = new PlatformDotnetSessionSetAndUnlockProcessor(lockNodeId, lockId, entries, isDiff, - staticData, timeout); + proc = new PlatformDotnetSessionSetAndUnlockProcessor(data.lockNodeId(), data.lockId(), data.items(), data.isDiff(), + data.staticObjects(), data.timeout()); } - else + else { + UUID lockNodeId = reader.readUuid(); + long lockId = reader.readLong(); + proc = new PlatformDotnetSessionSetAndUnlockProcessor(lockNodeId, lockId); + } cache.invoke(key, proc); http://git-wip-us.apache.org/repos/asf/ignite/blob/930b73eb/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionData.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionData.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionData.java index 85ceec8..23bfe4c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionData.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionData.java @@ -28,6 +28,7 @@ import org.apache.ignite.internal.util.typedef.internal.S; import java.sql.Timestamp; import java.util.Map; +import java.util.TreeMap; import java.util.UUID; /** @@ -38,6 +39,9 @@ public class PlatformDotnetSessionData implements Binarylizable { /** Items. */ private Map items; + /** Diff flag. */ + private boolean isDiff; + /** Static objects. */ @GridToStringExclude private byte[] staticObjects; @@ -62,6 +66,13 @@ public class PlatformDotnetSessionData implements Binarylizable { } /** + * @return Diff flag. + */ + public boolean isDiff() { + return isDiff; + } + + /** * @return Static objects. */ public byte[] staticObjects() { @@ -104,15 +115,6 @@ public class PlatformDotnetSessionData implements Binarylizable { } /** - * Ctor. - * - * @param timeout Timeout. - */ - public PlatformDotnetSessionData(int timeout) { - this.timeout = timeout; - } - - /** * Locks the session state data. * * @param lockNodeId Lock node ID. @@ -196,10 +198,11 @@ public class PlatformDotnetSessionData implements Binarylizable { * @return Copied state data. */ private PlatformDotnetSessionData copyWithoutLockInfo() { - PlatformDotnetSessionData res = new PlatformDotnetSessionData(timeout); + PlatformDotnetSessionData res = new PlatformDotnetSessionData(); res.staticObjects = staticObjects; res.items = items; + res.timeout = timeout; return res; } @@ -212,7 +215,15 @@ public class PlatformDotnetSessionData implements Binarylizable { raw.writeUuid(lockNodeId); raw.writeLong(lockId); raw.writeTimestamp(lockTime); - raw.writeObject(items); + + raw.writeBoolean(isDiff); + raw.writeInt(items.size()); + + for (Map.Entry e : items.entrySet()) { + raw.writeString(e.getKey()); + raw.writeByteArray(e.getValue()); + } + raw.writeByteArray(staticObjects); } @@ -224,7 +235,14 @@ public class PlatformDotnetSessionData implements Binarylizable { lockNodeId = raw.readUuid(); lockId = raw.readLong(); lockTime = raw.readTimestamp(); - items = raw.readObject(); + + items = new TreeMap<>(); + isDiff = !raw.readBoolean(); + int count = raw.readInt(); + + for (int i = 0; i < count; i++) + items.put(raw.readString(), raw.readByteArray()); + staticObjects = raw.readByteArray(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/930b73eb/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs index 1b85fd9..f36a0d2 100644 --- a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs +++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs @@ -461,8 +461,8 @@ namespace Apache.Ignite.AspNet { ((ICacheInternal) Cache).Invoke((int) Op.Unlock, w => { - WriteLockInfo(w, lockId); w.WriteBoolean(false); // Only unlock. + WriteLockInfo(w, lockId); w.WriteString(key); }); } @@ -478,15 +478,9 @@ namespace Apache.Ignite.AspNet ((ICacheInternal) cache).Invoke((int) Op.SetAndUnlock, w => { - WriteLockInfo(w, data.LockId); w.WriteBoolean(true); // Unlock and update. w.WriteString(key); - - // TODO: Refactor - data.Items.WriteBinary((IBinaryWriter) w); - - w.WriteByteArray(data.StaticObjects); - w.WriteInt(data.Timeout); + w.WriteObject(data); }); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/930b73eb/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs index e3b9cea..2bf6dbb 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs @@ -596,8 +596,8 @@ namespace Apache.Ignite.Core.Impl.Binary AddSystemType(0, r => new AffinityKey(r), "affKey"); AddSystemType(BinaryUtils.TypePlatformJavaObjectFactoryProxy, r => new PlatformJavaObjectFactoryProxy()); AddSystemType(0, r => new ObjectInfoHolder(r)); - AddSystemType(0, r => new SessionStateData(r), "PlatformDotnetSessionData"); - AddSystemType(0, r => new SessionStateLockResult(r), "PlatformDotnetSessionLockResult"); + AddSystemType(0, r => new SessionStateData(r), typeNameOverride: "PlatformDotnetSessionData"); + AddSystemType(0, r => new SessionStateLockResult(r), typeNameOverride: "PlatformDotnetSessionLockResult"); } } }