swamirishi commented on code in PR #8677:
URL: https://github.com/apache/ozone/pull/8677#discussion_r2236896956


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/BackgroundService.java:
##########
@@ -122,13 +122,24 @@ protected synchronized void setInterval(long newInterval, 
TimeUnit newUnit) {
 
   public abstract BackgroundTaskQueue getTasks();
 
+  protected void execTaskCompletion() { }

Review Comment:
   I don't think this is required



##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/BackgroundService.java:
##########
@@ -122,13 +122,24 @@ protected synchronized void setInterval(long newInterval, 
TimeUnit newUnit) {
 
   public abstract BackgroundTaskQueue getTasks();
 
+  protected void execTaskCompletion() { }
+
   /**
    * Run one or more background tasks concurrently.
    * Wait until all tasks to return the result.
    */
   public class PeriodicalTask implements Runnable {
     @Override
-    public synchronized void run() {
+    public void run() {
+      // wait for previous set of tasks to complete
+      try {
+        future.join();
+      } catch (RuntimeException e) {
+        LOG.error("Background service execution failed.", e);
+      } finally {
+        execTaskCompletion();

Review Comment:
   We can simply addAndIncreament while submitting



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