< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/share/runner/ThreadsRunner.java

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


  64     private class ManagedThread extends Thread {
  65 
  66         private Stresser stresser;
  67         private Throwable exception;
  68         private Runnable test;
  69         private boolean shouldWait;
  70 
  71         public ManagedThread(Runnable test) {
  72             super(test.toString());
  73             this.test = test;
  74             this.shouldWait = true;
  75             this.stresser = new Stresser(this.getName(), runParams.getStressOptions());
  76         }
  77 
  78         public void run() {
  79             wicket.waitFor();
  80             try {
  81                 stresser.start(runParams.getIterations());
  82                 while (!this.isInterrupted() && stresser.iteration()) {
  83                     test.run();
  84                     yield();
  85                 }
  86                 waitForOtherThreads();
  87             } catch (OutOfMemoryError oom) {
  88                 waitForOtherThreads();
  89                 if (test instanceof OOMStress) {
  90                     // Test stressing OOM, not a failure.
  91                     log.info("Caught OutOfMemoryError in OOM stress test, omitting exception.");
  92                 } else {
  93                     failWithException(oom);
  94                 }
  95             } catch (Throwable t) {
  96                 waitForOtherThreads();
  97                 failWithException(t);
  98             } finally {
  99                 stresser.finish();
 100             }
 101         }
 102 
 103         private void waitForOtherThreads() {
 104             if (shouldWait) {




  64     private class ManagedThread extends Thread {
  65 
  66         private Stresser stresser;
  67         private Throwable exception;
  68         private Runnable test;
  69         private boolean shouldWait;
  70 
  71         public ManagedThread(Runnable test) {
  72             super(test.toString());
  73             this.test = test;
  74             this.shouldWait = true;
  75             this.stresser = new Stresser(this.getName(), runParams.getStressOptions());
  76         }
  77 
  78         public void run() {
  79             wicket.waitFor();
  80             try {
  81                 stresser.start(runParams.getIterations());
  82                 while (!this.isInterrupted() && stresser.iteration()) {
  83                     test.run();
  84                     Thread.yield();
  85                 }
  86                 waitForOtherThreads();
  87             } catch (OutOfMemoryError oom) {
  88                 waitForOtherThreads();
  89                 if (test instanceof OOMStress) {
  90                     // Test stressing OOM, not a failure.
  91                     log.info("Caught OutOfMemoryError in OOM stress test, omitting exception.");
  92                 } else {
  93                     failWithException(oom);
  94                 }
  95             } catch (Throwable t) {
  96                 waitForOtherThreads();
  97                 failWithException(t);
  98             } finally {
  99                 stresser.finish();
 100             }
 101         }
 102 
 103         private void waitForOtherThreads() {
 104             if (shouldWait) {


< prev index next >