lucene
lucene copied to clipboard
LUCENE-9869 allow for configuring a custom cache purge scheduler in Monitor (aka Luwak)
Description
By default org.apache.lucene.monitor.Monitor will create a new thread per instance in order to schedule its cache purge periodic task. This is not always the desired behaviour as for example one could create a large number of Monitor instances in a single JVM to separate business domains. In such case it would be counterproductive to create a new thread for each instance of Monitor. Instead through introduction of PurgeScheduler interface one can now implement its own scheduling strategy.
#10908
Solution
Introduced a new method to MonitorConfiguration that allows to provide a custom implementation of PurgeScheduler.
Tests
Used this new API in an external codebase to confirm its proper behaviour and usefulness.
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 Lucene maintainers access to contribute to my PR branch. (optional but recommended)
- [x] I have developed this patch against the
main
branch. - [x] I have run
./gradlew check
. - [x] I have added tests for my changes.
@romseygeek @uschindler can you have a look at this PR. Do you think it is a move in a right direction? How can I improve it so it can be merged?
This sounds reasonable to me @pawel-bugalski-dynatrace but I'm not familiar with Monitor/Luwak's code. It looks like there are conflicts -- is this PR still relevant? Thanks @pawel-bugalski-dynatrace!
This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the [email protected] list. Thank you for your contribution!
This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the [email protected] list. Thank you for your contribution!