You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "David Smiley (Jira)" <ji...@apache.org> on 2024/11/24 20:46:00 UTC
[jira] [Created] (SOLR-17573) Make TimeSource a global singleton; never a field or param of any code
David Smiley created SOLR-17573:
-----------------------------------
Summary: Make TimeSource a global singleton; never a field or param of any code
Key: SOLR-17573
URL: https://issues.apache.org/jira/browse/SOLR-17573
Project: Solr
Issue Type: Task
Security Level: Public (Default Security Level. Issues are Public)
Reporter: David Smiley
Time is an ever-present concept used in lots of code. TimeSource.java in Solr is an attempt to make it pluggable so that tests or simulations can manipulate it. However, it only applies to code that is using TimeSource, which presently is done by passing TimeSource all over the place across APIs. It's so annoying that I wish to change the approach. Proposal: make it a global instance that only tests/simulations might touch. Tests would need to reset it, of course.
If we're truly wholistic about this, we might make System.nanoTime forbidden but... wow... maybe we should? If only the JDK's time was manipulatable.
Finally; we aren't we using java.time.Clock which appears designed for pluggable time?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org