Mikhail Mazursky created CASSANDRA-5584:
-------------------------------------------
Summary: Incorrect use of System.nanoTime()
Key: CASSANDRA-5584
URL: https://issues.apache.org/jira/browse/CASSANDRA-5584
Project: Cassandra
Issue Type: Bug
Reporter: Mikhail Mazursky
Priority: Trivial
>From System.nanoTime() JavaDoc:
{noformat}
For example, to measure how long some code takes to execute:
long startTime = System.nanoTime();
// ... the code being measured ...
long estimatedTime = System.nanoTime() - startTime;
To compare two nanoTime values
long t0 = System.nanoTime();
...
long t1 = System.nanoTime();
one should use t1 - t0 < 0, not t1 < t0, because of the possibility of
numerical overflow.
{noformat}
I found one place with such incorrect use that can result in overflow and in
incorrect timeout handling. See attached patch.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira