szetszwo commented on code in PR #11294:
URL: https://github.com/apache/ozone/pull/11294#discussion_r4075086780


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientShortCircuit.java:
##########
@@ -653,4 +591,45 @@ public boolean equals(Object obj) {
           && this.blockLocalId == that.blockLocalId;
     }
   }
+
+  class TimeoutScheduler {
+    private Timer timer;
+    private int cancelCount = 0;
+
+    synchronized void init(String prefix) {
+      Preconditions.assertNull(timer, "timer");
+      timer = new Timer(prefix + "-Timer");
+    }
+
+    synchronized void schedule(RequestKey key, RequestEntry entry, int 
timeoutMs) {
+      if (timer == null) {
+        return;
+      }
+      final TimerTask task = new TimerTask() {
+        @Override
+        public void run() {
+          requestTimeout(key);
+        }
+      };
+      timer.schedule(task, timeoutMs);
+      entry.getFuture().whenComplete((r, e) -> cancel(task));

Review Comment:
   That's a good point!  Let me revert the change of the timerTask in order to 
make this PR simple.



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