You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by "Dmytro Dragan (JIRA)" <ji...@apache.org> on 2015/09/25 16:47:04 UTC

[jira] [Issue Comment Deleted] (STORM-1069) Usage of System.currentTimeMillis() in KafkaSpout can create delays

     [ https://issues.apache.org/jira/browse/STORM-1069?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmytro Dragan updated STORM-1069:
---------------------------------
    Comment: was deleted

(was: I agree with you,@revans2.

I think we can change:

{code}
        long now = System.currentTimeMillis();
        if ((now - _lastUpdateMs) > _spoutConfig.stateUpdateIntervalMs)
{code}

on
 
{code}
        long diffWithNow = System.currentTimeMillis() - _lastUpdateMs;
        if (diffWithNow > _spoutConfig.stateUpdateIntervalMs || diffWithNow < 0) {
{code})

> Usage of  System.currentTimeMillis() in KafkaSpout can create delays
> --------------------------------------------------------------------
>
>                 Key: STORM-1069
>                 URL: https://issues.apache.org/jira/browse/STORM-1069
>             Project: Apache Storm
>          Issue Type: Bug
>          Components: storm-kafka
>            Reporter: Dmytro Dragan
>            Priority: Trivial
>              Labels: newbie
>
> _System.currentTimeMillis()_ returns the current time (wall-clock). Cause of this, you can suddenly get too big or even negative duration measured operation if between calls _System.currentTimeMillis()_ has changed the time (the adjusted time protocol NTP, administrator corrected clock, etc).
> Theoretically, _(now - _lastUpdateMs)_ in 125 line could return negative values.
> The better solution is to use _System.nanoTime()_ for measure elapsed time.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)