[ 
https://issues.apache.org/jira/browse/HBASE-21774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16787039#comment-16787039
 ] 

Andrew Purtell edited comment on HBASE-21774 at 3/7/19 6:01 PM:
----------------------------------------------------------------

The patch looks fine.

I think the javadoc of monotonicTime should reiterate that it is NOT a better 
"currentTime", for sake of clarity. Also, I think we would be missing the other 
caveat from Hadoop's javadoc:

{quote}
This function can return a negative value and it must be handled correctly by 
callers. See the documentation of System#nanoTime for caveats.
{quote}
 
Make these changes and I'd be +1


was (Author: apurtell):
The patch looks fine.

I think the javadoc of monotonicTime should reiterate that it is NOT a better 
"currentTime", for sake of clarity. Also, I think we would be missing the other 
caveat from Hadoop's javadoc:

{quote}
   * This function can return a negative value and it must be handled correctly
   * by callers. See the documentation of System#nanoTime for caveats.
{quote}
 
Make these changes and I'd be +1

> do not use currentTimeMillis to measure intervals
> -------------------------------------------------
>
>                 Key: HBASE-21774
>                 URL: https://issues.apache.org/jira/browse/HBASE-21774
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Sergey Shelukhin
>            Assignee: Dmitriy Kuharev
>            Priority: Minor
>         Attachments: HBASE-21774.master.001.patch, 
> HBASE-21774.master.002.patch, HBASE-21774.master.003.patch
>
>
> I've noticed it in a few places in the code... 
> currentMillis can go backwards and have other artifacts.
> nanoTime should be used for intervals (see 
> [https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#nanoTime()|https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#nanoTime()]
>  ) unless it's both the case that the calls are frequent and nanoTime will 
> result in perf overhead, and also that artifacts from negative intervals and 
> such are relatively harmless or possible to work around in the code.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to