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 06:20:58 UTC
[dubbo] branch 3.0 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
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0 by this push:
new dc8ba01 fix when consumer shutdown occurs npe (#9409)
dc8ba01 is described below
commit dc8ba019dcf913c3e8294f4f6a340357eddab787
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 a7c0f58..6037261 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
@@ -130,7 +130,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.