You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "SchopenhauerZhang (via GitHub)" <gi...@apache.org> on 2023/02/16 11:38:16 UTC

[GitHub] [rocketmq-client-go] SchopenhauerZhang commented on issue #994: Should unlock queue sending unlock(42) request to brokers where orderly consumer shutdown

SchopenhauerZhang commented on issue #994:
URL: https://github.com/apache/rocketmq-client-go/issues/994#issuecomment-1432953207

   如果是正常退出可以考虑加上unlock;
   比如
   ````
   trylock()
   defer unlock()
   xxxx
   ````
   但是如果是异常或者程序interrupt,broker会在到期后强制转移使用权;
   ````
   if (lockEntry.isExpired()) {
                               lockEntry.setClientId(clientId);
                               lockEntry.setLastUpdateTimestamp(System.currentTimeMillis());
                               log.warn(
                                   "tryLockBatch, message queue lock expired, I got it. Group: {} OldClientId: {} NewClientId: {} {}",
                                   group,
                                   oldClientId,
                                   clientId,
                                   mq);
                               lockedMqs.add(mq);
                               continue;
    }
   ````
   isExpired后,会强制将锁给到此时的请求者,完成所有权转换。
   
   
   


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