imbajin commented on code in PR #3329:
URL: https://github.com/apache/hugegraph/pull/3329#discussion_r4275829266
##########
hugegraph-commons/hugegraph-rpc/src/main/java/org/apache/hugegraph/rpc/RpcConsumerConfig.java:
##########
@@ -70,28 +69,119 @@ public <T> T serviceProxy(String interfaceId) {
@Override
public <T> T serviceProxy(String graph, String interfaceId) {
- ConsumerConfig<T> config = this.consumerConfig(graph, interfaceId);
- ConsumerBootstrap<T> bootstrap = Bootstraps.from(config);
- this.bootstraps.add(bootstrap);
- return bootstrap.refer();
+ String serviceId = graph == null ? interfaceId : interfaceId + ":" +
graph;
+ AtomicReference<T> proxy = new AtomicReference<>();
+ this.configs.compute(serviceId, (key, existing) -> {
+ @SuppressWarnings("unchecked")
+ ConsumerConfig<T> config = existing == null ?
this.consumerConfig(graph, interfaceId) :
+ (ConsumerConfig<T>) existing;
+ ConsumerBootstrap<T> bootstrap = Bootstraps.from(config);
+ try {
+ proxy.set(bootstrap.refer());
+ this.bootstraps.add(bootstrap);
+ } catch (RuntimeException | Error failure) {
+ // Retain the cleanup owner even when refer never returned a
proxy.
+ this.bootstraps.add(bootstrap);
+ throwFailure(this.cleanup(bootstrap, failure));
+ }
+ return config;
+ });
+ return proxy.get();
+ }
+
+ @Override
+ public boolean removeServiceProxy(String graph, String interfaceId, Object
proxy) {
+ String serviceId = graph == null ? interfaceId : interfaceId + ":" +
graph;
+ boolean[] removed = {false};
+ this.configs.computeIfPresent(serviceId, (key, config) -> {
+ for (ConsumerBootstrap<?> bootstrap : this.bootstraps) {
+ if (bootstrap.getConsumerConfig() == config &&
bootstrap.getProxyIns() == proxy) {
Review Comment:
Thanks. The SOFA 5.7.6 source path is confirmed, but the native
destroy-failure sequence has not been reproduced. Existing
serviceId/ConsumerConfig references are shared by multiple proxies, so they
cannot safely replace a per-registration identity. Following the agreed scope,
this conflict refresh will not introduce a new cleanup registry or a null-proxy
matching fallback. I have recorded a separate follow-up to reproduce this
sequence with a second live proxy of the same service before choosing a narrow
fix. Global provider destruction still retains the bootstrap for retry. Leaving
this thread open because the reported failure path is not fixed.
--
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]