Copilot commented on code in PR #10504:
URL: https://github.com/apache/cloudstack/pull/10504#discussion_r2128239203


##########
engine/orchestration/src/main/java/com/cloud/agent/manager/DirectAgentAttache.java:
##########
@@ -165,7 +165,7 @@ protected synchronized void runInContext() {
                     PingCommand cmd = resource.getCurrentStatus(_id);
                     int retried = 0;
                     while (cmd == null && ++retried <= 
_HostPingRetryCount.value()) {
-                        Thread.sleep(1000*_HostPingRetryTimer.value());
+                        wait(1000 * _HostPingRetryTimer.value());

Review Comment:
   Missing InterruptedException handling: `wait(...)` throws 
InterruptedException. Surround this call with a try/catch or declare the 
exception to prevent compilation errors.
   ```suggestion
                           try {
                               wait(1000 * _HostPingRetryTimer.value());
                           } catch (InterruptedException e) {
                               logger.warn("PingTask interrupted while waiting 
to retry ping [id: {}, uuid: {}, name: {}]", _id, _uuid, _name, e);
                               Thread.currentThread().interrupt(); // Restore 
the interrupted status
                               break;
                           }
   ```



##########
engine/orchestration/src/main/java/com/cloud/agent/manager/DirectAgentAttache.java:
##########
@@ -165,7 +165,7 @@ protected synchronized void runInContext() {
                     PingCommand cmd = resource.getCurrentStatus(_id);
                     int retried = 0;
                     while (cmd == null && ++retried <= 
_HostPingRetryCount.value()) {
-                        Thread.sleep(1000*_HostPingRetryTimer.value());
+                        wait(1000 * _HostPingRetryTimer.value());

Review Comment:
   [nitpick] For clarity, consider qualifying the call as `this.wait(...)` to 
make it explicit that the wait is on the current object’s monitor.
   ```suggestion
                           this.wait(1000 * _HostPingRetryTimer.value());
   ```



-- 
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: commits-unsubscr...@cloudstack.apache.org

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

Reply via email to