marmot-z commented on code in PR #14730:
URL: https://github.com/apache/dubbo/pull/14730#discussion_r1983036479


##########
dubbo-common/src/main/java/org/apache/dubbo/common/utils/LockUtils.java:
##########
@@ -31,18 +31,24 @@ public class LockUtils {
 
     public static void safeLock(Lock lock, int timeout, Runnable runnable) {
         try {
-            if (!lock.tryLock(timeout, TimeUnit.MILLISECONDS)) {
-                logger.error(
-                        LoggerCodeConstants.INTERNAL_ERROR,
-                        "",
-                        "",
-                        "Try to lock failed, timeout: " + timeout,
-                        new TimeoutException());
+            boolean interrupted = false;
+            try {
+                if (!lock.tryLock(timeout, TimeUnit.MILLISECONDS)) {
+                    logger.error(
+                            LoggerCodeConstants.INTERNAL_ERROR,
+                            "",
+                            "",
+                            "Try to lock failed, timeout: " + timeout,
+                            new TimeoutException());
+                }
+            } catch (InterruptedException e) {
+                logger.warn(LoggerCodeConstants.INTERNAL_ERROR, "", "", "Try 
to lock failed", e);
+                interrupted = true;
             }
             runnable.run();

Review Comment:
   i got it, thanks for your patient explanation.



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