You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/06/22 09:57:27 UTC

[GitHub] [dubbo] guohao commented on a diff in pull request #10193: [3.0] Clear up env when destroy

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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org