g3rg0 commented on code in PR #6677:
URL: https://github.com/apache/hive/pull/6677#discussion_r3728798543


##########
llap-client/src/java/org/apache/hadoop/hive/registry/ClusterNotReadyException.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * 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.hadoop.hive.registry;
+
+import java.io.IOException;
+
+public class ClusterNotReadyException extends IOException {
+
+  public ClusterNotReadyException(Throwable cause) {
+    super(cause);
+  }

Review Comment:
   Done. ClusterNotReadyException now includes: 
     1. private static final long serialVersionUID = 1L to suppress 
serialization warnings.
     2. A String message constructor and a String message, Throwable cause 
constructor, allowing callers to provide descriptive context in upstream logs 
without relying solely on nested exception text.
     
   The original Throwable cause-only constructor is preserved for backward 
compatibility with existing call sites.



##########
llap-client/src/java/org/apache/hadoop/hive/registry/impl/ZkRegistryBase.java:
##########
@@ -651,14 +652,14 @@ protected final synchronized PathChildrenCache 
ensureInstancesCache(
         long elapsedNs = System.nanoTime() - startTimeNs;
         if (deltaNs == 0 || deltaNs <= elapsedNs) {
           LOG.error("Unable to start curator PathChildrenCache", e);
-          throw new IOException(e);
+          throw new ClusterNotReadyException(e);
         }
         LOG.warn("The cluster is not started yet (InvalidACL); will retry");
         try {
           Thread.sleep(Math.min(sleepTimeMs, (deltaNs - elapsedNs)/1000000L));
         } catch (InterruptedException e1) {
           LOG.error("Interrupted while retrying the PathChildrenCache 
startup");
-          throw new IOException(e1);
+          throw new ClusterNotReadyException(e1);

Review Comment:
   Done. In the second commit:
     1. Thread.currentThread().interrupt() is now called immediately upon 
catching InterruptedException, restoring the interrupt flag before the 
exception is re-thrown as ClusterNotReadyException. This ensures any 
higher-level shutdown/cancellation logic (e.g., executor service shutdown, 
daemon termination hooks) can observe the interrupt.
     2. The exception is now passed to the LOG.error call (LOG.error("...", 
e1)) so the full stack trace and cause are preserved in the logs.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to