You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/12/23 16:19:02 UTC

[GitHub] [ignite] nizhikov opened a new pull request #8602: IGNITE-13734 .Net: Register service return type on method invocation

nizhikov opened a new pull request #8602:
URL: https://github.com/apache/ignite/pull/8602


   This PR fixes bug that occurs on the invocation of the service method that has not registered return type.
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] nizhikov commented on a change in pull request #8602: IGNITE-13734 .NET: Register service return type on method invocation

Posted by GitBox <gi...@apache.org>.
nizhikov commented on a change in pull request #8602:
URL: https://github.com/apache/ignite/pull/8602#discussion_r548886683



##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
##########
@@ -162,7 +168,34 @@ public BinaryType RegisterEnum(string typeName, IEnumerable<KeyValuePair<string,
         /// <returns>Type or null.</returns>
         public string GetTypeName(int id)
         {
-            return DoOutInOp((int) Op.GetType, w => w.WriteInt(id), r => Marshaller.StartUnmarshal(r).ReadString());
+            try
+            {
+                return DoOutInOp((int) Op.GetType, w =>

Review comment:
       Fixed.

##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
##########
@@ -162,7 +168,34 @@ public BinaryType RegisterEnum(string typeName, IEnumerable<KeyValuePair<string,
         /// <returns>Type or null.</returns>
         public string GetTypeName(int id)
         {
-            return DoOutInOp((int) Op.GetType, w => w.WriteInt(id), r => Marshaller.StartUnmarshal(r).ReadString());
+            try
+            {
+                return DoOutInOp((int) Op.GetType, w =>
+                {
+                    w.WriteInt(id);
+                    w.WriteByte(DotNetPlatformId);
+                }, r => Marshaller.StartUnmarshal(r).ReadString());
+            }
+            catch (BinaryObjectException)
+            {
+                if (!Marshaller.RegisterSameJavaType.Value)
+                    throw;
+            }
+
+            // Try to get java type name and register corresponding DotNet type.
+            var javaTypeName = DoOutInOp((int) Op.GetType, w =>
+            {
+                w.WriteInt(id);
+                w.WriteByte(JavaPlatformId);
+            }, r => Marshaller.StartUnmarshal(r).ReadString());
+
+            RegisterType(id, Marshaller.GetTypeName(javaTypeName), false);
+
+            return DoOutInOp((int) Op.GetType, w =>

Review comment:
       Fixed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] nizhikov merged pull request #8602: IGNITE-13734 .NET: Register service return type on method invocation

Posted by GitBox <gi...@apache.org>.
nizhikov merged pull request #8602:
URL: https://github.com/apache/ignite/pull/8602


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] ptupitsyn commented on a change in pull request #8602: IGNITE-13734 .Net: Register service return type on method invocation

Posted by GitBox <gi...@apache.org>.
ptupitsyn commented on a change in pull request #8602:
URL: https://github.com/apache/ignite/pull/8602#discussion_r548884247



##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
##########
@@ -162,7 +168,34 @@ public BinaryType RegisterEnum(string typeName, IEnumerable<KeyValuePair<string,
         /// <returns>Type or null.</returns>
         public string GetTypeName(int id)
         {
-            return DoOutInOp((int) Op.GetType, w => w.WriteInt(id), r => Marshaller.StartUnmarshal(r).ReadString());
+            try
+            {
+                return DoOutInOp((int) Op.GetType, w =>

Review comment:
       Let's extract a method `string GetTypeName(int id, bool java)`.

##########
File path: modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServiceProxyTest.cs
##########
@@ -18,6 +18,7 @@
 namespace Apache.Ignite.Core.Tests.Services
 {
     using System;
+    using System.CodeDom;

Review comment:
       Unused import

##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
##########
@@ -162,7 +168,34 @@ public BinaryType RegisterEnum(string typeName, IEnumerable<KeyValuePair<string,
         /// <returns>Type or null.</returns>
         public string GetTypeName(int id)
         {
-            return DoOutInOp((int) Op.GetType, w => w.WriteInt(id), r => Marshaller.StartUnmarshal(r).ReadString());
+            try
+            {
+                return DoOutInOp((int) Op.GetType, w =>
+                {
+                    w.WriteInt(id);
+                    w.WriteByte(DotNetPlatformId);
+                }, r => Marshaller.StartUnmarshal(r).ReadString());
+            }
+            catch (BinaryObjectException)
+            {
+                if (!Marshaller.RegisterSameJavaType.Value)
+                    throw;
+            }
+
+            // Try to get java type name and register corresponding DotNet type.
+            var javaTypeName = DoOutInOp((int) Op.GetType, w =>
+            {
+                w.WriteInt(id);
+                w.WriteByte(JavaPlatformId);
+            }, r => Marshaller.StartUnmarshal(r).ReadString());
+
+            RegisterType(id, Marshaller.GetTypeName(javaTypeName), false);
+
+            return DoOutInOp((int) Op.GetType, w =>

Review comment:
       I think we can return the name of the registered type from above, no need to call into Java again.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] nizhikov commented on pull request #8602: IGNITE-13734 .NET: Register service return type on method invocation

Posted by GitBox <gi...@apache.org>.
nizhikov commented on pull request #8602:
URL: https://github.com/apache/ignite/pull/8602#issuecomment-751265446


   @ptupitsyn Thanks for the review.
   All comments fixed.
   Please, take a look one more time.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] nizhikov commented on pull request #8602: IGNITE-13734 .Net: Register service return type on method invocation

Posted by GitBox <gi...@apache.org>.
nizhikov commented on pull request #8602:
URL: https://github.com/apache/ignite/pull/8602#issuecomment-750864219


   Hello, @ptupitsyn 
   Please, take a look at this fix.
   
   Currently, we unable to read binary type from service response if it not registered explicitly.
   This issue continues to fix transparent service invocation like #8568, [IGNITE-10075](https://issues.apache.org/jira/browse/IGNITE-10075).
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org