< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/stress/thread/thread005.java

Print this page
rev 56807 : [mq]: 8232684-v2


 143             out.println("#");
 144             return 2;
 145         }
 146         STOP = true;
 147 
 148         if (DEBUG_MODE)
 149             out.println("The test have PASSED.");
 150         return 0;
 151     }
 152 
 153     private static boolean GO = false;
 154     private static boolean STOP = false;
 155 
 156     /**
 157      * The thread activity: do nothing special, but do not
 158      * free CPU time so that the thread's memory could not
 159      * be moved to swap file.
 160      */
 161     public void run() {
 162         while (!GO && !timeout())
 163             yield();
 164         while (!STOP && !timeout())
 165             ;
 166     }
 167 
 168     private static long startTime = System.currentTimeMillis();
 169 
 170     /**
 171      * Check if timeout for this test is exceeded.
 172      */
 173     private boolean timeout() {
 174         long elapsedTime = System.currentTimeMillis() - startTime;
 175         return elapsedTime > TIMEOUT;
 176     }
 177 
 178     /**
 179      * Yield to other threads for the given amount of
 180      * <code>time</code> (milliseconds).
 181      */
 182     private static void doSleep(long time) throws InterruptedException {
 183         //


 143             out.println("#");
 144             return 2;
 145         }
 146         STOP = true;
 147 
 148         if (DEBUG_MODE)
 149             out.println("The test have PASSED.");
 150         return 0;
 151     }
 152 
 153     private static boolean GO = false;
 154     private static boolean STOP = false;
 155 
 156     /**
 157      * The thread activity: do nothing special, but do not
 158      * free CPU time so that the thread's memory could not
 159      * be moved to swap file.
 160      */
 161     public void run() {
 162         while (!GO && !timeout())
 163             Thread.yield();
 164         while (!STOP && !timeout())
 165             ;
 166     }
 167 
 168     private static long startTime = System.currentTimeMillis();
 169 
 170     /**
 171      * Check if timeout for this test is exceeded.
 172      */
 173     private boolean timeout() {
 174         long elapsedTime = System.currentTimeMillis() - startTime;
 175         return elapsedTime > TIMEOUT;
 176     }
 177 
 178     /**
 179      * Yield to other threads for the given amount of
 180      * <code>time</code> (milliseconds).
 181      */
 182     private static void doSleep(long time) throws InterruptedException {
 183         //
< prev index next >