vyommani commented on code in PR #668:
URL: https://github.com/apache/ranger/pull/668#discussion_r2354717271


##########
tagsync/src/main/java/org/apache/ranger/tagsync/sink/tagadmin/TagAdminRESTSink.java:
##########
@@ -181,16 +181,13 @@ public void run() {
                     return;
                 }
             } else {
-                // Only sleep when HA is enabled, similar to user sync
-                if (TagSyncConfig.getInstance().isTagSyncHAEnabled()) {
-                    try {
-                        long sleepInterval = 
TagSyncConfig.getTagSyncHAPassiveSleepInterval();
-                        LOG.debug("Sleeping for [{}] milliSeconds as this 
server is running in passive mode", sleepInterval);
-                        Thread.sleep(sleepInterval);
-                    } catch (InterruptedException interrupted) {
-                        LOG.error("Interrupted..: ", interrupted);
-                        return;
-                    }
+                try {
+                    long sleepInterval = 
TagSyncConfig.getTagSyncHAPassiveSleepInterval();
+                    LOG.debug("Sleeping for [{}] milliSeconds as this server 
is running in passive mode", sleepInterval);
+                    Thread.sleep(sleepInterval);
+                } catch (InterruptedException interrupted) {

Review Comment:
   Thanks for the question! My suggestion to call 
Thread.currentThread().interrupt() when catching InterruptedException follows 
Java’s concurrency best practices to preserve the thread’s interrupt status, 
ensuring that higher-level code (e.g., thread pools or executors) can detect 
interruptions and handle them appropriately (e.g., for graceful shutdown). 
   
   When to call Thread.currentThread().interrupt() When catching 
InterruptedException in code that should propagate the interrupt signal to 
callers, such as in a thread pool or long-running thread. Restoring the 
interrupt status allows frameworks like ExecutorService or calling code to 
detect the interruption and take action (e.g., exit a loop or terminate a task).
   
   Even I have see in Ranger code we are not doing at all, it can be good start.



-- 
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: dev-unsubscr...@ranger.apache.org

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

Reply via email to