You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/08/31 12:09:42 UTC

[dubbo] branch 3.0-multi-instances updated (6c65c31 -> bdf30e6)

This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a change to branch 3.0-multi-instances
in repository https://gitbox.apache.org/repos/asf/dubbo.git.


    from 6c65c31  Fix NPE when destroy
     add 899638c  Fix ut
     new bdf30e6  add failback logic for ut

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java  | 10 +++++++++-
 .../apache/dubbo/rpc/protocol/dubbo/ArgumentCallbackTest.java  |  8 ++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

[dubbo] 01/01: add failback logic for ut

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0-multi-instances
in repository https://gitbox.apache.org/repos/asf/dubbo.git

commit bdf30e63f12542abf908231865977cf1c3f61c81
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Tue Aug 31 20:09:14 2021 +0800

    add failback logic for ut
---
 .../apache/dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java  | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java
index 7c5ce8c..0f0aecf 100644
--- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java
+++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/CallbackServiceCodec.java
@@ -34,6 +34,7 @@ import org.apache.dubbo.rpc.Invoker;
 import org.apache.dubbo.rpc.Protocol;
 import org.apache.dubbo.rpc.ProxyFactory;
 import org.apache.dubbo.rpc.RpcInvocation;
+import org.apache.dubbo.rpc.model.ApplicationModel;
 import org.apache.dubbo.rpc.model.ModuleModel;
 import org.apache.dubbo.rpc.model.ProviderModel;
 import org.apache.dubbo.rpc.model.ScopeModelUtil;
@@ -134,7 +135,14 @@ class CallbackServiceCodec {
             // one channel can have multiple callback instances, no need to re-export for different instance.
             if (!channel.hasAttribute(cacheKey)) {
                 if (!isInstancesOverLimit(channel, url, clazz.getName(), instid, false)) {
-                    ModuleModel moduleModel = ScopeModelUtil.getModuleModel(inv.getServiceModel().getModuleModel());
+                    ModuleModel moduleModel;
+                    if (inv.getServiceModel() == null) {
+                        moduleModel = ApplicationModel.defaultModel().getDefaultModule();
+                        logger.error("Unable to get Service Model from Invocation. Please check if your invocation failed! " +
+                            "This error only happen in UT cases! Invocation:" + inv);
+                    } else {
+                        moduleModel = inv.getServiceModel().getModuleModel();
+                    }
                     ServiceDescriptor serviceDescriptor = ScopeModelUtil.getApplicationModel(moduleModel).getApplicationServiceRepository().registerService(clazz);
                     ProviderModel providerModel = new ProviderModel(BaseServiceMetadata.buildServiceKey(exportUrl.getPath(), group, exportUrl.getVersion()),
                         inst,