SOLR-17461 (cleanup) Move ClusterState string "Interner" json parser to Utils
https://issues.apache.org/jira/browse/SOLR-17461
- SOLR-17461: (cleanup) Move ClusterState string "Interner" json parser to Utils
Description
ClusterState.setStrInternerParser and its functionality is potentially of general utility and it's also a bit distracting in ClusterState. I also don't like CoreContainer being involved in initializing it (CoreContainer is doing too much!). It's doing it because ClusterState is in SolrJ without Caffeine being on the classpath. Instead, imagine a class in solr-core that implements this Function. Utils could then self-initialize via reflection detecting if that class is available, otherwise gracefully resorting to the non-intern mechanism. No touching CoreContainer which is way too busy doing many things.
Solution
moved the common method to Utils, the WeakStringInterner initialization is based on availability of caffeine classed and it will conditionally change the STR_INTERNER_OBJ_BUILDER of the ClusterState object
Tests
it is not applicable but will try to add junit for same.
Checklist
Please review the following and check all that apply:
- [X] I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
- [X] I have created a Jira issue and added the issue ID to my pull request title.
- [X] I have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
- [X] I have developed this patch against the
mainbranch. - [X] I have run
./gradlew check. - [] I have added tests for my changes.
- [] I have added documentation for the Reference Guide
- [X] I have added a changelog entry for my change