ptupitsyn commented on a change in pull request #8635:
URL: https://github.com/apache/ignite/pull/8635#discussion_r559389578



##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
##########
@@ -109,6 +108,10 @@ public Marshaller(BinaryConfiguration cfg, ILogger log = 
null)
             if (typeNames != null)
                 foreach (string typeName in typeNames)
                     AddUserType(new BinaryTypeConfiguration(typeName), 
typeResolver);
+
+            _registerSameJavaType = _cfg.NameMapper == null || 

Review comment:
       As we agreed on the [dev 
list](http://apache-ignite-developers.2346864.n4.nabble.com/DISCUSSION-Net-BinaryTypes-transparency-tp50998p51029.html),
 `_registerSameJavaType` should take effect only within Java service call or 
`ExecuteJavaTask`.

##########
File path: 
modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessorClient.cs
##########
@@ -99,11 +105,38 @@ public BinaryType RegisterEnum(string typeName, 
IEnumerable<KeyValuePair<string,
         }
 
         /** <inheritdoc /> */
-        public string GetTypeName(int id)
+        public string GetTypeName(int id, bool registerSameJavaType)
+        {
+            try
+            {
+                return GetTypeName(id, BinaryProcessor.DotNetPlatformId);
+            }
+            catch (Exception)

Review comment:
       Same as above - please don't use exceptions for control flow. For thin 
client we can use `errorFunc` parameter of the `DoOutInOp` function to handle 
errors without throwing exceptions.

##########
File path: 
modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryProcessor.cs
##########
@@ -165,16 +165,17 @@ public BinaryType RegisterEnum(string typeName, 
IEnumerable<KeyValuePair<string,
         /// Gets the type name by id.
         /// </summary>
         /// <param name="id">The identifier.</param>
+        /// <param name="registerSameJavaType">True if should register type 
both for dotnet and java platforms.</param>        
         /// <returns>Type or null.</returns>
-        public string GetTypeName(int id)
+        public string GetTypeName(int id, bool registerSameJavaType)
         {
             try
             {
                 return GetTypeName(id, DotNetPlatformId);
             }
             catch (BinaryObjectException)
             {
-                if (!Marshaller.RegisterSameJavaType.Value)
+                if (!registerSameJavaType)

Review comment:
       Let's avoid using exceptions for control flow. At least we can push the 
flag to `PlatformBinaryProcessor.OP_GET_TYPE` handler, which already has an 
exception handler.




----------------------------------------------------------------
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:
[email protected]


Reply via email to