Andrew Kyle Purtell created HBASE-25912:
-------------------------------------------

             Summary: Ban System.currentTimeMillis with a build enforcer
                 Key: HBASE-25912
                 URL: https://issues.apache.org/jira/browse/HBASE-25912
             Project: HBase
          Issue Type: Sub-task
          Components: build
            Reporter: Andrew Kyle Purtell
            Assignee: Andrew Kyle Purtell


We introduced EnvironmentEdgeManager a long time ago as a way to inject 
alternate clocks (gettimeofday() aka System.currentTimeMillis()) for unit 
tests. In order for this to be effective, all callers that would otherwise use 
System.currentTimeMillis() must call EnvironmentEdgeManager.currentTime() 
instead, except obviously the implementors of EnvironmentEdge.

It's common for contributors to be unaware of this practice and reviewers might 
not catch it.

It will be much more important to have EnvironmentEdgeManager in use where 
expected once we have EnvironmentEdge also providing a monotonic clock source. 
(See parent.)

Introduce a build enforcer that bans System.currentTimeMillis() except where 
annotated to allow it.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to