You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Horst Gernhardt (JIRA)" <ji...@apache.org> on 2007/02/06 14:53:05 UTC

[jira] Created: (LANG-315) StopWatch: suspend() acts as split(), if followed by stop()

StopWatch: suspend() acts as split(), if followed by stop()
-----------------------------------------------------------

                 Key: LANG-315
                 URL: https://issues.apache.org/jira/browse/LANG-315
             Project: Commons Lang
          Issue Type: Bug
    Affects Versions: 2.2, 2.1, 2.0
            Reporter: Horst Gernhardt


In my opinion, it is a bug that suspend() acts as split(), if followed by stop(); see below:

        StopWatch sw = new StopWatch();

        sw.start();
        Thread.sleep(1000);
        sw.suspend();
        // Time 1 (ok)
        System.out.println(sw.getTime());

        Thread.sleep(2000);
        // Time 1 (again, ok)
        System.out.println(sw.getTime());

        sw.resume();
        Thread.sleep(3000);
        sw.suspend();
        // Time 2 (ok)
        System.out.println(sw.getTime());

        Thread.sleep(4000);
        // Time 2 (again, ok)
        System.out.println(sw.getTime());

        Thread.sleep(5000);
        sw.stop();
        // Time 2 (should be, but is Time 3 => NOT ok)
        System.out.println(sw.getTime());


suspend/resume is like a pause, where time counter doesn't continue. So a following stop()-call shouldn't increase the time counter, should it?


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Closed: (LANG-315) StopWatch: suspend() acts as split(), if followed by stop()

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed LANG-315.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.3

I think this is definitely a bug, and I don't see fixing it being a negative thing for existing users. 

svn ci -m "Applying test and fix for LANG-315" src/
Sending        src/java/org/apache/commons/lang/time/StopWatch.java
Sending        src/test/org/apache/commons/lang/time/StopWatchTest.java
Transmitting file data ..
Committed revision 504351.

> StopWatch: suspend() acts as split(), if followed by stop()
> -----------------------------------------------------------
>
>                 Key: LANG-315
>                 URL: https://issues.apache.org/jira/browse/LANG-315
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.0, 2.1, 2.2
>            Reporter: Horst Gernhardt
>             Fix For: 2.3
>
>         Attachments: LANG-315.patch
>
>
> In my opinion, it is a bug that suspend() acts as split(), if followed by stop(); see below:
>         StopWatch sw = new StopWatch();
>         sw.start();
>         Thread.sleep(1000);
>         sw.suspend();
>         // Time 1 (ok)
>         System.out.println(sw.getTime());
>         Thread.sleep(2000);
>         // Time 1 (again, ok)
>         System.out.println(sw.getTime());
>         sw.resume();
>         Thread.sleep(3000);
>         sw.suspend();
>         // Time 2 (ok)
>         System.out.println(sw.getTime());
>         Thread.sleep(4000);
>         // Time 2 (again, ok)
>         System.out.println(sw.getTime());
>         Thread.sleep(5000);
>         sw.stop();
>         // Time 2 (should be, but is Time 3 => NOT ok)
>         System.out.println(sw.getTime());
> suspend/resume is like a pause, where time counter doesn't continue. So a following stop()-call shouldn't increase the time counter, should it?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (LANG-315) StopWatch: suspend() acts as split(), if followed by stop()

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated LANG-315:
-------------------------------

    Attachment: LANG-315.patch

Easy to test for and easy to fix.

Question being - do we want to fix this...

> StopWatch: suspend() acts as split(), if followed by stop()
> -----------------------------------------------------------
>
>                 Key: LANG-315
>                 URL: https://issues.apache.org/jira/browse/LANG-315
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.0, 2.1, 2.2
>            Reporter: Horst Gernhardt
>             Fix For: 2.3
>
>         Attachments: LANG-315.patch
>
>
> In my opinion, it is a bug that suspend() acts as split(), if followed by stop(); see below:
>         StopWatch sw = new StopWatch();
>         sw.start();
>         Thread.sleep(1000);
>         sw.suspend();
>         // Time 1 (ok)
>         System.out.println(sw.getTime());
>         Thread.sleep(2000);
>         // Time 1 (again, ok)
>         System.out.println(sw.getTime());
>         sw.resume();
>         Thread.sleep(3000);
>         sw.suspend();
>         // Time 2 (ok)
>         System.out.println(sw.getTime());
>         Thread.sleep(4000);
>         // Time 2 (again, ok)
>         System.out.println(sw.getTime());
>         Thread.sleep(5000);
>         sw.stop();
>         // Time 2 (should be, but is Time 3 => NOT ok)
>         System.out.println(sw.getTime());
> suspend/resume is like a pause, where time counter doesn't continue. So a following stop()-call shouldn't increase the time counter, should it?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org