You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "redlsz (via GitHub)" <gi...@apache.org> on 2026/03/27 13:08:02 UTC

[PR] [ISSUE #10225] Optimize HandleData locking mechanism to avoid unnecessary blocking [rocketmq]

redlsz opened a new pull request, #10226:
URL: https://github.com/apache/rocketmq/pull/10226

   <!-- Please make sure the target branch is right. In most case, the target branch should be `develop`. -->
   
   ### Which Issue(s) This PR Fixes
   
   <!-- Please ensure that the related issue has already been created, and [link this pull request to that issue using keywords](<https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword>) to ensure automatic closure. -->
   
   - Fixes #10225 
   
   ### Brief Description
   
   <!-- Write a brief description for your pull request to help the maintainer understand the reasons behind your changes. -->
   
   Add a non-blocking tryAcquire() as the fast path, and check the expiration condition before falling through to the blocking tryAcquire(timeout, unit)
   
   ### How Did You Test This Change?
   
   <!-- In order to ensure the code quality of Apache RocketMQ, we expect every pull request to have undergone thorough testing. -->
   
   Add a unit test to cover diff.
   


-- 
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-unsubscribe@rocketmq.apache.org

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


Re: [PR] [ISSUE #10225] Optimize HandleData locking mechanism to avoid unnecessary blocking [rocketmq]

Posted by "redlsz (via GitHub)" <gi...@apache.org>.
redlsz commented on code in PR #10226:
URL: https://github.com/apache/rocketmq/pull/10226#discussion_r3019402833


##########
proxy/src/main/java/org/apache/rocketmq/proxy/common/ReceiptHandleGroup.java:
##########
@@ -113,22 +113,40 @@ public HandleData(MessageReceiptHandle messageReceiptHandle) {
 
         public Long lock(long timeoutMs) {
             try {
-                boolean result = this.semaphore.tryAcquire(timeoutMs, TimeUnit.MILLISECONDS);
+                long expiredTimeMs = ConfigurationManager.getProxyConfig().getLockTimeoutMsInHandleGroup() * 3;

Review Comment:
   > Put it below tryAcquire
   
   Fixed



-- 
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-unsubscribe@rocketmq.apache.org

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


Re: [PR] [ISSUE #10225] Optimize HandleData locking mechanism to avoid unnecessary blocking [rocketmq]

Posted by "qianye1001 (via GitHub)" <gi...@apache.org>.
qianye1001 commented on code in PR #10226:
URL: https://github.com/apache/rocketmq/pull/10226#discussion_r3014614769


##########
proxy/src/main/java/org/apache/rocketmq/proxy/common/ReceiptHandleGroup.java:
##########
@@ -113,22 +113,40 @@ public HandleData(MessageReceiptHandle messageReceiptHandle) {
 
         public Long lock(long timeoutMs) {
             try {
-                boolean result = this.semaphore.tryAcquire(timeoutMs, TimeUnit.MILLISECONDS);
+                long expiredTimeMs = ConfigurationManager.getProxyConfig().getLockTimeoutMsInHandleGroup() * 3;

Review Comment:
   Put it below tryAcquire



-- 
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-unsubscribe@rocketmq.apache.org

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