You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by me...@apache.org on 2020/07/09 03:22:03 UTC
[dubbo] branch master updated: check invoker available status after
proxy created. (#6435)
This is an automated email from the ASF dual-hosted git repository.
mercyblitz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 58d5e51 check invoker available status after proxy created. (#6435)
58d5e51 is described below
commit 58d5e519af824f7d08dfa5c68e0403546f1fba9f
Author: ken.lj <ke...@gmail.com>
AuthorDate: Thu Jul 9 11:21:48 2020 +0800
check invoker available status after proxy created. (#6435)
---
.../java/org/apache/dubbo/config/ReferenceConfig.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
index 570f7a4..7bcc6ea 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
@@ -303,6 +303,8 @@ public class ReferenceConfig<T> extends ReferenceConfigBase<T> {
initialized = true;
+ checkInvokerAvailable();
+
// dispatch a ReferenceConfigInitializedEvent since 2.7.4
dispatch(new ReferenceConfigInitializedEvent(this, invoker));
}
@@ -377,6 +379,14 @@ public class ReferenceConfig<T> extends ReferenceConfigBase<T> {
}
}
+ if (logger.isInfoEnabled()) {
+ logger.info("Refer dubbo service " + interfaceClass.getName() + " from url " + invoker.getUrl());
+ }
+ // create service proxy
+ return (T) PROXY_FACTORY.getProxy(invoker, ProtocolUtils.isGeneric(generic));
+ }
+
+ private void checkInvokerAvailable() throws IllegalStateException {
if (shouldCheck() && !invoker.isAvailable()) {
invoker.destroy();
throw new IllegalStateException("Failed to check the status of the service "
@@ -390,11 +400,6 @@ public class ReferenceConfig<T> extends ReferenceConfigBase<T> {
+ " to the consumer "
+ NetUtils.getLocalHost() + " use dubbo version " + Version.getVersion());
}
- if (logger.isInfoEnabled()) {
- logger.info("Refer dubbo service " + interfaceClass.getName() + " from url " + invoker.getUrl());
- }
- // create service proxy
- return (T) PROXY_FACTORY.getProxy(invoker, ProtocolUtils.isGeneric(generic));
}
/**