You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2021/12/15 08:35:30 UTC
[dubbo] branch 3.0.5-release updated: fix when consumer shutdown occurs npe (#9409)
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch 3.0.5-release
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0.5-release by this push:
new c7c5af3 fix when consumer shutdown occurs npe (#9409)
c7c5af3 is described below
commit c7c5af3d156a6c369378a43f1a92b5e841ba31b5
Author: huazhongming <cr...@gmail.com>
AuthorDate: Wed Dec 15 14:20:37 2021 +0800
fix when consumer shutdown occurs npe (#9409)
fixes #9404
---
.../java/org/apache/dubbo/registry/client/InstanceAddressURL.java | 5 ++++-
.../apache/dubbo/rpc/protocol/dubbo/LazyConnectExchangeClient.java | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/InstanceAddressURL.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/InstanceAddressURL.java
index 7a5d7e7..3480f36 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/InstanceAddressURL.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/InstanceAddressURL.java
@@ -129,7 +129,10 @@ public class InstanceAddressURL extends URL {
@Override
public String getPath() {
- MetadataInfo.ServiceInfo serviceInfo = metadataInfo.getServiceInfo(getProtocolServiceKey());
+ MetadataInfo.ServiceInfo serviceInfo = null;
+ if (StringUtils.isNotEmpty(getProtocolServiceKey())) {
+ serviceInfo = metadataInfo.getServiceInfo(getProtocolServiceKey());
+ }
if (serviceInfo == null) {
return getServiceInterface();
}
diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/LazyConnectExchangeClient.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/LazyConnectExchangeClient.java
index a825ccd..f31144a 100644
--- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/LazyConnectExchangeClient.java
+++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/LazyConnectExchangeClient.java
@@ -58,7 +58,7 @@ final class LazyConnectExchangeClient implements ExchangeClient {
*/
private final boolean initialState;
private volatile ExchangeClient client;
- private AtomicLong warningCount = new AtomicLong(0);
+ private final AtomicLong warningCount = new AtomicLong(0);
public LazyConnectExchangeClient(URL url, ExchangeHandler requestHandler) {
// lazy connect, need set send.reconnect = true, to avoid channel bad status.