Wweiei commented on code in PR #5953:
URL: https://github.com/apache/shenyu/pull/5953#discussion_r1986715088
##########
shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/cache/ApacheDubboConfigCache.java:
##########
@@ -164,6 +178,64 @@ public ReferenceConfig<GenericService> initRefN(final
MetaData metaData, final S
return build(metaData, namespace);
}
+ /**
+ * Init ref reference config use dubboUpstream.
+ *
+ * @param selectorId the selectorId
+ * @param ruleData the rule data
+ * @param metaData the meta data
+ * @param namespace namespace
+ * @param dubboUpstream dubboUpstream
+ * @return the reference config
+ */
+ public ReferenceConfig<GenericService> initRefN(final String selectorId,
final RuleData ruleData, final MetaData metaData, final String namespace, final
DubboUpstream dubboUpstream) {
+ try {
+ String cacheKey = generateUpstreamCacheKey(selectorId,
ruleData.getId(), metaData.getId(), namespace, dubboUpstream);
+ ReferenceConfig<GenericService> referenceConfig =
cache.get(cacheKey);
+ if (StringUtils.isNoneBlank(referenceConfig.getInterface())) {
+ return referenceConfig;
+ }
+ } catch (ExecutionException e) {
+ LOG.error("initRefN dubbo ref exception", e);
+ }
+ return build(metaData, ruleData, namespace, selectorId, dubboUpstream);
+ }
+
+ /**
+ * generate dubbo upstream reference cache key.
+ *
+ * @param selectorId selectorId
+ * @param ruleId ruleId
+ * @param metaDataId metaDataId
+ * @param namespace namespace
+ * @param dubboUpstream dubboUpstream
+ * @return the reference config cache key
+ */
+ public String generateUpstreamCacheKey(final String selectorId, final
String ruleId, final String metaDataId, final String namespace, final
DubboUpstream dubboUpstream) {
+ StringJoiner stringJoiner = new StringJoiner("_");
Review Comment:
> search exist value
hi , What's the meaning of this? Should I replace _ with a constant? Or use
another method as String.join to replace the new StringJoiner("_")?
--
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]