Skip to content

Commit

Permalink
check invoker available status after proxy created. (#6435)
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenlj authored Jul 9, 2020
1 parent 40d03b0 commit 58d5e51
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ public synchronized void init() {

initialized = true;

checkInvokerAvailable();

// dispatch a ReferenceConfigInitializedEvent since 2.7.4
dispatch(new ReferenceConfigInitializedEvent(this, invoker));
}
Expand Down Expand Up @@ -377,6 +379,14 @@ private T createProxy(Map<String, String> map) {
}
}

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 "
Expand All @@ -390,11 +400,6 @@ private T createProxy(Map<String, String> map) {
+ " 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));
}

/**
Expand Down

0 comments on commit 58d5e51

Please sign in to comment.