alex-plekhanov commented on code in PR #12756:
URL: https://github.com/apache/ignite/pull/12756#discussion_r2820653296


##########
modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java:
##########
@@ -106,6 +106,8 @@ public static void main(String[] args) throws Exception {
             // It needs to set private static field 'ignite' of the 
IgniteNodeRunner class via reflection
             GridTestUtils.setFieldValue(new IgniteNodeRunner(), "ignite", 
ignite);
 
+            startParentPipeWatcher(ignite);

Review Comment:
   1. Wtachdog should be started before first closure executed (before 
`cfgClo.apply(cfg);`)
   2. We already have a watchdog thread in this class, maybe we can unify these 
watchdogs?



##########
modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java:
##########
@@ -127,6 +129,33 @@ public static void main(String[] args) throws Exception {
         }
     }
 
+    /**
+     * Checks that parent is alive.
+     *
+     * @param ignite Started Ignite instance in child JVM.
+     */
+    private static void startParentPipeWatcher(Ignite ignite) {
+        Thread thread = new Thread(() -> {
+            try {
+                while (System.in.read() != -1) {
+                    // No-op
+                }
+            }
+            catch (IOException e) {

Review Comment:
   In case of InterruptedException watchdog will exit without any actions.



##########
modules/compatibility/src/test/java/org/apache/ignite/compatibility/testframework/junits/IgniteCompatibilityNodeRunner.java:
##########
@@ -127,6 +129,33 @@ public static void main(String[] args) throws Exception {
         }
     }
 
+    /**
+     * Checks that parent is alive.
+     *
+     * @param ignite Started Ignite instance in child JVM.
+     */
+    private static void startParentPipeWatcher(Ignite ignite) {
+        Thread thread = new Thread(() -> {
+            try {
+                while (System.in.read() != -1) {
+                    // No-op
+                }
+            }
+            catch (IOException e) {
+                X.println("Failed to read parent stdin pipe, stopping 
compatibility node: " + e);
+            }
+
+            X.println("Parent JVM stdin pipe is closed, stopping compatibility 
node");
+
+            Ignition.stop(ignite.name(), true);

Review Comment:
   Stop also can potentially throw some exceptions, consider using try/finally 
here



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to