EHC ❯ Testcase depend on Thread.sleep
-
Bug
-
Status: Closed
-
-
Resolution: Fixed
-
-
-
drb
-
Reporter: sourceforgetracker
-
September 21, 2009
-
0
-
Watchers: 0
-
September 22, 2009
-
September 22, 2009
Description
testcase failed sometime because depend on Thread.sleep (); Thread.sleep() must not be reliable.
public class ThreadSleepTest { public static void main(String args[]) throws Exception{ final long interval = 100; int success = 0; int failed = 0; System.out.println(“test start… “); for(int i=0; i<100; i++){ long before = System.currentTimeMillis(); Thread.sleep(interval); long after = System.currentTimeMillis(); if(before+interval <= after){ success++; }else{ failed++; } } System.out.println (“Success: “+success); System.out.println(“failed : “+failed); } } Sourceforge Ticket ID: 1436326 - Opened By: kousuke_kikuchi - 22 Feb 2006 01:40 UTC
Re-opening so that I can properly close out these issues and have correct Resolution status in Jira