Tim Harsch created NIFI-5742:
--------------------------------

             Summary: StopWatch.getDuration produces incorrect results
                 Key: NIFI-5742
                 URL: https://issues.apache.org/jira/browse/NIFI-5742
             Project: Apache NiFi
          Issue Type: Bug
          Components: Core Framework
    Affects Versions: 0.8.0
            Reporter: Tim Harsch


getDuration will produce unexpected results when the StopWatch has been stopped.

See:  
https://github.com/apache/nifi/blob/02261311b3b3f765ebb394f8f101b0373a7fb3ab/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/StopWatch.java#L77

Currently, if the stopwatch has been stopped it returns the current nanos since 
epoch - (-1), which is meaningless at best and likely to cause issues for 
applications using this method.

It should either return an exception because the elapsed time has no meaning 
after being stopped, or return the elapsed time when the watch was stopped, or 
just keep going and return the current value.




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

Reply via email to