guohao commented on code in PR #10193:
URL: https://github.com/apache/dubbo/pull/10193#discussion_r903491820


##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java:
##########
@@ -532,17 +532,34 @@ private void createInvokerForRemote() {
 
     private void checkInvokerAvailable() throws IllegalStateException {
         if (shouldCheck() && !invoker.isAvailable()) {
-            invoker.destroy();
-            throw new IllegalStateException("Failed to check the status of the 
service "
-                + interfaceName
-                + ". No provider available for the service "
-                + (group == null ? "" : group + "/")
-                + interfaceName +
-                (version == null ? "" : ":" + version)
-                + " from the url "
-                + invoker.getUrl()
-                + " to the consumer "
-                + NetUtils.getLocalHost() + " use dubbo version " + 
Version.getVersion());
+            try {

Review Comment:
   It is better to adopt a more general-purpose mechanism to manage 
`ReferenceConfig`'s lifecycle in avoid of other `Exception` s or rollbacks may 
occur during initializing phase. Not only `checkAvailable()` 



##########
dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java:
##########
@@ -532,17 +532,34 @@ private void createInvokerForRemote() {
 
     private void checkInvokerAvailable() throws IllegalStateException {
         if (shouldCheck() && !invoker.isAvailable()) {
-            invoker.destroy();
-            throw new IllegalStateException("Failed to check the status of the 
service "
-                + interfaceName
-                + ". No provider available for the service "
-                + (group == null ? "" : group + "/")
-                + interfaceName +
-                (version == null ? "" : ":" + version)
-                + " from the url "
-                + invoker.getUrl()
-                + " to the consumer "
-                + NetUtils.getLocalHost() + " use dubbo version " + 
Version.getVersion());
+            try {

Review Comment:
   Other resources created and shared by `Config`s may also be took into 
consideration.
   - Service Discovery: Instance subscriptions/ URLs 
   - Network IO. Netty's EventLoop/ Timer/ Connections.
   - Caches 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to