vqianxiao commented on code in PR #15883:
URL: https://github.com/apache/dubbo/pull/15883#discussion_r2640204728
##########
dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java:
##########
@@ -208,27 +211,35 @@ public List<Invoker<T>> list(Invocation invocation)
throws RpcException {
BitList<Invoker<T>> availableInvokers;
SingleRouterChain<T> singleChain = null;
try {
+ if (routerChain != null) {
+ routerChain.getLock().readLock().lock();
+ }
+ boolean lockAcquired = false;
try {
- if (routerChain != null) {
- routerChain.getLock().readLock().lock();
+ if (!invokerRefreshReadLock.tryLock(LockUtils.DEFAULT_TIMEOUT,
TimeUnit.MILLISECONDS)) {
+ throw new RpcException("Failed to acquire read lock on
invokerRefreshLock within timeout");
Review Comment:
```java
if (!invokerRefreshReadLock.tryLock(LockUtils.DEFAULT_TIMEOUT,
TimeUnit.MILLISECONDS)) {
throw new RpcException("Failed to acquire read lock on
invokerRefreshLock within timeout. " +
"Timeout: " +
LockUtils.DEFAULT_TIMEOUT + "ms, " +
"Lock state:
[readLockHeld=" + invokerRefreshLock.getReadLockCount() +
", writeLockHeld=" +
invokerRefreshLock.isWriteLocked() +
",
writeLockHeldByCurrentThread=" +
invokerRefreshLock.isWriteLockedByCurrentThread() +
"], Service: " +
getConsumerUrl().getServiceKey());
}
```
What do you think of my modification like this
--
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]