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/04/28 08:48:25 UTC

[GitHub] [ignite] ivandasch opened a new pull request #7751: IGNITE-10100 Refactoring of services proxy. Preparation for testing.

ivandasch opened a new pull request #7751:
URL: https://github.com/apache/ignite/pull/7751


   


----------------------------------------------------------------
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] ivandasch commented on a change in pull request #7751: IGNITE-10100 Implement calling .NET service from java

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
##########
@@ -63,6 +69,22 @@
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** */
+    private static final Method PLATFORM_SERVICE_INVOKE_METHOD;
+
+    static {
+        Method mtd;
+
+        try {
+            mtd = PlatformService.class.getMethod("invokeMethod", String.class, boolean.class, Object[].class);
+        }
+        catch (NoSuchMethodException e) {

Review comment:
       Unfortunatelly, we cannot remove this catch, because `NoSuchMethodException` is a checked one. You suggests to fail node? To be honest, I don't think that failing node in static initializer is a good variant. Let's explain. Let's imagine situation, that someone mistakenly delete `invokeMethod` from code, but then he or she get failing tests and easily correct this mistake. Add complex behaviour and fail node is a little bit overengineering, isn't it?




----------------------------------------------------------------
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] ivandasch commented on a change in pull request #7751: IGNITE-10100 Implement calling .NET service from java

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
##########
@@ -63,6 +69,22 @@
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** */
+    private static final Method PLATFORM_SERVICE_INVOKE_METHOD;
+
+    static {
+        Method mtd;
+
+        try {
+            mtd = PlatformService.class.getMethod("invokeMethod", String.class, boolean.class, Object[].class);
+        }
+        catch (NoSuchMethodException e) {

Review comment:
       I suggest just to throw `ExceptionInInitializerError.html` [1](https://docs.oracle.com/javase/8/docs/api/java/lang/ExceptionInInitializerError.html), it's unchecked exception and created just for this case. What do you think?




----------------------------------------------------------------
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] alex-plekhanov commented on a change in pull request #7751: IGNITE-10100 Implement calling .NET service from java

Posted by GitBox <gi...@apache.org>.
alex-plekhanov commented on a change in pull request #7751:
URL: https://github.com/apache/ignite/pull/7751#discussion_r428619902



##########
File path: modules/core/src/test/java/org/apache/ignite/platform/PlatformServiceCallTask.java
##########
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.platform;
+
+import java.util.UUID;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.internal.processors.platform.PlatformNativeException;
+import org.apache.ignite.internal.processors.platform.services.PlatformService;
+import org.apache.ignite.resources.IgniteInstanceResource;
+
+/**
+ *  Basic task to calling {@link PlatformService} from Java.
+ */
+public class PlatformServiceCallTask extends AbstractPlatformServiceCallTask {
+    /** {@inheritDoc} */
+    @Override ComputeJobAdapter createJob(String svcName) {
+        return new PlatformServiceCallJob(svcName);
+    }
+
+    /** */
+    static class PlatformServiceCallJob extends AbstractServiceCallJob {
+        /** */
+        @SuppressWarnings("unused")
+        @IgniteInstanceResource
+        private transient Ignite ignite;
+
+        /**
+         * @param srvcName Service name.
+         */
+        PlatformServiceCallJob(String srvcName) {
+            super(srvcName);
+        }
+
+        /** {@inheritDoc} */
+        @Override void runTest() {
+            TestPlatformService srv = ignite.services().serviceProxy(srvcName, TestPlatformService.class, false);
+
+            {
+                UUID nodeId = srv.getNodeId();
+                assertTrue(ignite.cluster().nodes().stream().anyMatch(n -> n.id().equals(nodeId)));
+            }
+
+            {
+                UUID expUuid = UUID.randomUUID();
+                srv.setGuidProp(expUuid);
+                assertEquals(expUuid, srv.getGuidProp());
+            }
+
+            {
+                TestValue exp = new TestValue(1, "test");
+                srv.setValueProp(exp);
+                assertEquals(exp, srv.getValueProp());
+            }
+
+            try {
+                srv.errorMethod();
+
+                throw new RuntimeException("Expected exception, but invocation was success");
+            }
+            catch (IgniteException e) {
+                assertTrue(PlatformNativeException.class.isAssignableFrom(e.getCause().getClass()));
+
+                PlatformNativeException nativeEx = (PlatformNativeException)e.getCause();
+
+                assertTrue(nativeEx.toString().contains("Failed method"));
+            }

Review comment:
       GridTestUtils.assertThrowsAnyCause?




----------------------------------------------------------------
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] ivandasch commented on a change in pull request #7751: IGNITE-10100 Implement calling .NET service from java

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
##########
@@ -833,12 +833,26 @@ else if (err instanceof IgniteException)
      */
     public static Object readInvocationResult(PlatformContext ctx, BinaryRawReaderEx reader)
         throws IgniteCheckedException {
+        return readInvocationResult(ctx, reader, false);
+    }
+
+    /**
+     * Reads invocation result (of a job/service/etc) using a common protocol.
+     *
+     * @param ctx Platform context.
+     * @param reader Reader.
+     * @param deserialize If {@code true} deserialize invocation result.
+     * @return Result.
+     * @throws IgniteCheckedException When invocation result is an error.
+     */
+    public static Object readInvocationResult(PlatformContext ctx, BinaryRawReaderEx reader, boolean deserialize)
+            throws IgniteCheckedException {
         // 1. Read success flag.
         boolean success = reader.readBoolean();
 
         if (success)
             // 2. Return result as is.
-            return reader.readObjectDetached();
+            return deserialize ? reader.readObject() : reader.readObjectDetached();

Review comment:
       Unfortunatelly, the approach you suggested doesn't work, but is more elegant, without doubts. But these methods returns Object and need more additional works. But my approach works and tests prove this. So I suggest leave it as is.




----------------------------------------------------------------
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] ivandasch commented on a change in pull request #7751: IGNITE-10100 Implement calling .NET service from java

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
##########
@@ -1030,11 +1031,11 @@ private CancelResult removeServiceFromCache(String name) throws IgniteCheckedExc
                 Service svc = ctx.service();
 
                 if (svc != null) {
-                    if (!srvcCls.isAssignableFrom(svc.getClass()))
+                    if (srvcCls.isAssignableFrom(svc.getClass()))
+                        return (T)svc;
+                    else if (!PlatformService.class.isAssignableFrom(svc.getClass()))

Review comment:
       Fixed

##########
File path: modules/core/src/main/java/org/apache/ignite/platform/PlatformServiceGetter.java
##########
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.platform;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for setting mapping between java interface's method and getter of platform service property (mostly useful
+ * for .NET services). Name mapping is constructed by concatenating {@link PlatformServiceGetter#prefix}
+ * with {@link PlatformServiceGetter#value}.
+ * <p/>
+ * For example, this annotated java inerface method:
+ * <pre>
+ * &#64;PlatformServiceGetter("SomeProperty")
+ * SomeProperty getSomeProperty()
+ * </pre>
+ * will be mapped to {@code get_SomeProperty} method name and corresponds to the following .NET property:
+ * <pre>
+ * SomeProperty &#123; get; &#125;
+ * </pre>
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD})
+public @interface PlatformServiceGetter {

Review comment:
       Agree, fixed

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
##########
@@ -354,6 +392,49 @@ T proxy() {
         return proxy;
     }
 
+    /**
+     * @param mtd Method to invoke.
+     */
+    String methodName(Method mtd) {
+        GridServiceMethodReflectKey mtdKey = new GridServiceMethodReflectKey(mtd.getName(), mtd.getParameterTypes());
+
+        return srvMtds.getOrDefault(mtdKey, mtd.getName());

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] ivandasch commented on a change in pull request #7751: IGNITE-10100 Implement calling .NET service from java

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
##########
@@ -63,6 +69,22 @@
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** */
+    private static final Method PLATFORM_SERVICE_INVOKE_METHOD;
+
+    static {
+        Method mtd;
+
+        try {
+            mtd = PlatformService.class.getMethod("invokeMethod", String.class, boolean.class, Object[].class);
+        }
+        catch (NoSuchMethodException e) {

Review comment:
       Unfortunatelly, we cannot remove this catch, because `NoSuchMethodException` this is checked one. You suggests to fail node? To be honest, I don't think that failing node in static initializer is a good variant. Let's explain. Let's imagine situation, that someone mistakenly delete `invokeMethod` from code, but then he or she get failing tests and easily correct this mistake. Add complex behaviour and fail node is a little bit overengineering, isn't it?




----------------------------------------------------------------
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 #7751: IGNITE-10100 Implement calling .NET service from java

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
##########
@@ -63,6 +69,22 @@
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** */
+    private static final Method PLATFORM_SERVICE_INVOKE_METHOD;
+
+    static {
+        Method mtd;
+
+        try {
+            mtd = PlatformService.class.getMethod("invokeMethod", String.class, boolean.class, Object[].class);
+        }
+        catch (NoSuchMethodException e) {

Review comment:
       Yes, we should fail the node, because this error indicates a nasty bug in our code.
   Unchecked exception looks good to me.




----------------------------------------------------------------
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] ivandasch commented on a change in pull request #7751: IGNITE-10100 Implement calling .NET service from java

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
##########
@@ -63,6 +69,22 @@
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** */
+    private static final Method PLATFORM_SERVICE_INVOKE_METHOD;
+
+    static {
+        Method mtd;
+
+        try {
+            mtd = PlatformService.class.getMethod("invokeMethod", String.class, boolean.class, Object[].class);
+        }
+        catch (NoSuchMethodException e) {

Review comment:
       Fixed as proposed.




----------------------------------------------------------------
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] alex-plekhanov commented on a change in pull request #7751: IGNITE-10100 Implement calling .NET service from java

Posted by GitBox <gi...@apache.org>.
alex-plekhanov commented on a change in pull request #7751:
URL: https://github.com/apache/ignite/pull/7751#discussion_r427965102



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
##########
@@ -1030,11 +1031,11 @@ private CancelResult removeServiceFromCache(String name) throws IgniteCheckedExc
                 Service svc = ctx.service();
 
                 if (svc != null) {
-                    if (!srvcCls.isAssignableFrom(svc.getClass()))
+                    if (srvcCls.isAssignableFrom(svc.getClass()))
+                        return (T)svc;
+                    else if (!PlatformService.class.isAssignableFrom(svc.getClass()))

Review comment:
       Use { } for statement here

##########
File path: modules/core/src/main/java/org/apache/ignite/platform/PlatformServiceGetter.java
##########
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.platform;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for setting mapping between java interface's method and getter of platform service property (mostly useful
+ * for .NET services). Name mapping is constructed by concatenating {@link PlatformServiceGetter#prefix}
+ * with {@link PlatformServiceGetter#value}.
+ * <p/>
+ * For example, this annotated java inerface method:
+ * <pre>
+ * &#64;PlatformServiceGetter("SomeProperty")
+ * SomeProperty getSomeProperty()
+ * </pre>
+ * will be mapped to {@code get_SomeProperty} method name and corresponds to the following .NET property:
+ * <pre>
+ * SomeProperty &#123; get; &#125;
+ * </pre>
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD})
+public @interface PlatformServiceGetter {

Review comment:
       Platform package means that these classes related to all platforms. I think it's not a good idea to bind setters and getters to C# style naming. I think these two annotations redundant at all. Call to getters and setters it's a not common pattern of using services, but if someone will need it, it can be easily implemented using `PlatformServiceMethod`. I see no advantages of using dedicated `PlatformServiceGetter` and `PlatformServiceSetter` annotations for this. There still copy/paste errors possible and brings some complexity to code.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
##########
@@ -833,12 +833,26 @@ else if (err instanceof IgniteException)
      */
     public static Object readInvocationResult(PlatformContext ctx, BinaryRawReaderEx reader)
         throws IgniteCheckedException {
+        return readInvocationResult(ctx, reader, false);
+    }
+
+    /**
+     * Reads invocation result (of a job/service/etc) using a common protocol.
+     *
+     * @param ctx Platform context.
+     * @param reader Reader.
+     * @param deserialize If {@code true} deserialize invocation result.
+     * @return Result.
+     * @throws IgniteCheckedException When invocation result is an error.
+     */
+    public static Object readInvocationResult(PlatformContext ctx, BinaryRawReaderEx reader, boolean deserialize)
+            throws IgniteCheckedException {
         // 1. Read success flag.
         boolean success = reader.readBoolean();
 
         if (success)
             // 2. Return result as is.
-            return reader.readObjectDetached();
+            return deserialize ? reader.readObject() : reader.readObjectDetached();

Review comment:
       I think it's not enough for correct deserialization sometimes (for arrays and collection of objects). We should also do `unwrapBinary()`.
   Also (optionally), we can use `unwrapBinary()` directly after method invocation in `GridServiceProxy` instead of adding new methods to `PlatformUtils`, `PlatformService`, `PlatformAbstractService`.

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
##########
@@ -354,6 +392,49 @@ T proxy() {
         return proxy;
     }
 
+    /**
+     * @param mtd Method to invoke.
+     */
+    String methodName(Method mtd) {
+        GridServiceMethodReflectKey mtdKey = new GridServiceMethodReflectKey(mtd.getName(), mtd.getParameterTypes());
+
+        return srvMtds.getOrDefault(mtdKey, mtd.getName());

Review comment:
       I think the methods cache is redundant. If you will use just one annotation (see previous comment) this method will be simplified to something like:
   ```
           PlatformServiceMethod ann = mtd.getDeclaredAnnotation(PlatformServiceMethod.class);
           
           return ann == null ? mtd.getName() : ann.value(); 
   ```
   I think it will work faster then construction of GridServiceMethodReflectKey and find in hash map.




----------------------------------------------------------------
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] ivandasch commented on a change in pull request #7751: IGNITE-10100 Implement calling .NET service from java

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
##########
@@ -63,6 +69,22 @@
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** */
+    private static final Method PLATFORM_SERVICE_INVOKE_METHOD;
+
+    static {
+        Method mtd;
+
+        try {
+            mtd = PlatformService.class.getMethod("invokeMethod", String.class, boolean.class, Object[].class);
+        }
+        catch (NoSuchMethodException e) {

Review comment:
       I suggest just to throw `ExceptionInInitializerError` [1](https://docs.oracle.com/javase/8/docs/api/java/lang/ExceptionInInitializerError.html), it's unchecked exception and created just for this case. What do you think?




----------------------------------------------------------------
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] ivandasch commented on a change in pull request #7751: IGNITE-10100 Implement calling .NET service from java

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
##########
@@ -63,6 +69,22 @@
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** */
+    private static final Method PLATFORM_SERVICE_INVOKE_METHOD;
+
+    static {
+        Method mtd;
+
+        try {
+            mtd = PlatformService.class.getMethod("invokeMethod", String.class, boolean.class, Object[].class);
+        }
+        catch (NoSuchMethodException e) {

Review comment:
       I suggest just to throw `ExceptionInInitializerError` [doc](https://docs.oracle.com/javase/8/docs/api/java/lang/ExceptionInInitializerError.html), it's unchecked exception and created just for this case. What do you think?




----------------------------------------------------------------
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] asfgit closed pull request #7751: IGNITE-10100 Implement calling .NET service from java

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #7751:
URL: https://github.com/apache/ignite/pull/7751


   


----------------------------------------------------------------
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] ivandasch commented on a change in pull request #7751: IGNITE-10100 Implement calling .NET service from java

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



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProxy.java
##########
@@ -63,6 +69,22 @@
     /** */
     private static final long serialVersionUID = 0L;
 
+    /** */
+    private static final Method PLATFORM_SERVICE_INVOKE_METHOD;
+
+    static {
+        Method mtd;
+
+        try {
+            mtd = PlatformService.class.getMethod("invokeMethod", String.class, boolean.class, Object[].class);
+        }
+        catch (NoSuchMethodException e) {

Review comment:
       Unfortunatelly, we cannot remove this catch, because `NoSuchMethodException` this is checked one. You suggests to fail node? To be honest, I don't think that failing node in static initializer is a good variant. Let's explain. Let's imagine situatuin, that someone mistakenly delete `invokeMethod` from code, but then he or she get failing tests and easily correct this mistake. 




----------------------------------------------------------------
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