commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sandy McArthur" <sandy...@gmail.com>
Subject Re: svn commit: r383224 - /jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
Date Sun, 05 Mar 2006 03:12:25 GMT
How about a Thread.sleep() instead of a busy wait? eg:

private void spin(long now) {
  long end = now  +1000;
  while (System.currentTimeMillis() <= end) {
    Thread.sleep(Math.max(1, end - System.currentTimeMillis()));
  }
}

On 3/4/06, scolebourne@apache.org <scolebourne@apache.org> wrote:
> Author: scolebourne
> Date: Sat Mar  4 15:24:49 2006
> New Revision: 383224
>
> URL: http://svn.apache.org/viewcvs?rev=383224&view=rev
> Log:
> Allow one second to avoid test failures
>
> Modified:
>     jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
>
> Modified: jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
> URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java?rev=383224&r1=383223&r2=383224&view=diff
> ==============================================================================
> --- jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
(original)
> +++ jakarta/commons/proper/io/trunk/src/test/org/apache/commons/io/filefilter/FileFilterTestCase.java
Sat Mar  4 15:24:49 2006
> @@ -524,7 +524,7 @@
>      }
>
>      private void spin(long now) {
> -        while (System.currentTimeMillis() <= now);
> +        while (System.currentTimeMillis() <= now + 1000);
>      }
>
>  }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>


--
Sandy McArthur

"He who dares not offend cannot be honest."
- Thomas Paine

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


Mime
View raw message