Home | History | Annotate | Download | only in thread
      1 package test.thread;
      2 
      3 import org.testng.annotations.Test;
      4 
      5 import java.util.Random;
      6 
      7 @Test
      8 public class TrueParallelSampleTest extends BaseThreadTest {
      9   static Random random = new Random(System.currentTimeMillis());
     10 
     11   private void log(String s) {
     12     logString(s);
     13     try {
     14       Thread.sleep(random.nextInt(10));
     15     } catch (InterruptedException ex) {
     16       Thread.yield();
     17     }
     18     logString(s);
     19     logCurrentThread();
     20   }
     21 
     22   public void m1() {
     23     log("m1");
     24   }
     25 
     26   public void m2() {
     27     log("m2");
     28   }
     29 
     30   public void m3() {
     31     log("m3");
     32   }
     33 
     34   public void m4() {
     35     log("m4");
     36   }
     37 
     38   public void m5() {
     39     log("m5");
     40   }
     41 }
     42