BobSong-dev opened a new pull request, #7348:
URL: https://github.com/apache/shenyu/pull/7348
Fixes #6799
## Background
`ApacheDubboProxyService.getReferenceConfig` runs on every Dubbo-routed
request and re-parses
`selectorData.getHandle()` from JSON into `List<DubboUpstream>` (Gson
reflection + allocation),
then filters it, even though the handle only changes on configuration sync.
## Changes
- `ApacheDubboConfigCache.getOrParseUpstreams(selectorData)` parses the
handle once and caches
the filtered upstream list, bounded by the same `CACHE_MAX_COUNT` as the
reference cache;
- Entries are keyed by selector id and validated against the exact handle
string, so a changed
selector handle re-parses automatically and stale reads are impossible
without any
invalidation hook; blank or missing handles return an empty list (default
plugin-config
path unchanged);
- The proxy service now reuses the cached list; per-request JSON
deserialization is gone.
## Verification
Local:
- `./mvnw test -pl ...shenyu-plugin-apache-dubbo -am`: BUILD SUCCESS
(ApacheDubboConfigCacheTest
covers filtering of disabled/blank-registry upstreams, cache reuse on
unchanged handle,
re-parse on changed handle, and blank-handle handling;
ApacheDubboProxyServiceTest unchanged
and passing);
- `./mvnw checkstyle:check`: passed.
--
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]