janhoy commented on pull request #488:
URL: https://github.com/apache/solr/pull/488#issuecomment-1004811565
> This seems like a much better solution than mine. I will try to implement
it in this pull request.
I'd look at creating a pool
`ScheduledExecutorService.newMDCAwareSingleThreadExecutor(new
SolrNamedThreadFactory("currencyProvider"))`, and in `reload()` wrap the logic
inside a Runnable that is passed to the exector and then return immediately.
That way, we only refresh rates if there are actual search requests, but
once a request comes, it will only trigger a background refresh, while the
request will succeed on the existing rates (stale).
If you add proper synchronization on read/write of the `protected
OpenExchangeRates rates` class, then the amount of time you need to lock while
swapping in the new object should be minimal.
--
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]