Skip to content

Commit

Permalink
Skip catch SkipFailbackWrapperException in NacosRegistry
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbumenJ committed Jun 26, 2023
1 parent 680481c commit 5a06f3b
Showing 1 changed file with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.dubbo.registry.Registry;
import org.apache.dubbo.registry.RegistryNotifier;
import org.apache.dubbo.registry.support.FailbackRegistry;
import org.apache.dubbo.registry.support.SkipFailbackWrapperException;
import org.apache.dubbo.rpc.RpcException;

import com.alibaba.nacos.api.common.Constants;
Expand Down Expand Up @@ -163,7 +164,9 @@ public List<URL> lookup(final URL url) {
urls.addAll(buildURLs(url, instances));
}
return urls;
} catch (Exception cause) {
} catch (SkipFailbackWrapperException exception) {
throw exception;
} catch (Exception cause) {
throw new RpcException("Failed to lookup " + url + " from nacos " + getUrl() + ", cause: " + cause.getMessage(), cause);
}
}
Expand All @@ -185,6 +188,8 @@ public void doRegister(URL url) {
} else {
logger.info("Please set 'dubbo.registry.parameters.register-consumer-url=true' to turn on consumer url registration.");
}
} catch (SkipFailbackWrapperException exception) {
throw exception;
} catch (Exception cause) {
throw new RpcException("Failed to register " + url + " to nacos " + getUrl() + ", cause: " + cause.getMessage(), cause);
}
Expand All @@ -199,7 +204,9 @@ public void doUnregister(final URL url) {
getUrl().getGroup(Constants.DEFAULT_GROUP),
instance.getIp()
, instance.getPort());
} catch (Exception cause) {
} catch (SkipFailbackWrapperException exception) {
throw exception;
} catch (Exception cause) {
throw new RpcException("Failed to unregister " + url + " to nacos " + getUrl() + ", cause: " + cause.getMessage(), cause);
}
}
Expand Down Expand Up @@ -251,7 +258,9 @@ private void doSubscribe(final URL url, final NacosAggregateListener listener, f
subscribeEventListener(serviceName, subscriberURL, listener);
}
}
} catch (Throwable cause) {
} catch (SkipFailbackWrapperException exception) {
throw exception;
} catch (Throwable cause) {
throw new RpcException("Failed to subscribe " + url + " to nacos " + getUrl() + ", cause: " + cause.getMessage(), cause);
}
}
Expand Down Expand Up @@ -355,7 +364,9 @@ private Set<String> filterServiceNames(NacosServiceName serviceName) {
.map(NacosServiceName::toString)
.collect(Collectors.toList()));
return serviceNames;
} catch (Throwable cause) {
} catch (SkipFailbackWrapperException exception) {
throw exception;
} catch (Throwable cause) {
throw new RpcException("Failed to filter serviceName from nacos, url: " + getUrl() + ", serviceName: " + serviceName + ", cause: " + cause.getMessage(), cause);
}
}
Expand Down Expand Up @@ -458,7 +469,9 @@ private Set<String> getAllServiceNames() {
serviceNames.addAll(listView.getData());
}
return serviceNames;
} catch (Throwable cause) {
} catch (SkipFailbackWrapperException exception) {
throw exception;
} catch (Throwable cause) {
throw new RpcException("Failed to get all serviceName from nacos, url: " + getUrl() + ", cause: " + cause.getMessage(), cause);
}
}
Expand Down

0 comments on commit 5a06f3b

Please sign in to comment.