< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/thread/strace001.java

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


 345             log.display("OutOfMemoryError is thrown in thread " + num);
 346         } catch (StackOverflowError e) {
 347             // Recursion is too deep, so exit peacefully
 348             log.display("StackOverflowError is thrown in thread " + num);
 349         }
 350     } // run()
 351 
 352     private void recursionJava(int maxDepth, int currentDepth) {
 353         // A short delay. Otherwise the method will reach the specified depth
 354         // almost instantly
 355         try {
 356             sleep(1);
 357         } catch (InterruptedException e) {
 358             log.complain("Unexpected exception");
 359             e.printStackTrace(log.getOutStream());
 360             strace001.testFailed = true;
 361         }
 362 
 363         currentDepth++;
 364         if (maxDepth > currentDepth) {
 365             yield();
 366             if (mixed) {
 367                 int result = recursionNative(maxDepth, currentDepth, true);
 368 
 369                  if (result == 1) {
 370                      log.display("Fatal error (OutOfMemoryError or "
 371                                + "StackOverflow) is thrown in native method of "
 372                                + " thread " + num);
 373                      return;
 374                  } else if (result == 2) {
 375                      log.complain("Unexpected exception is thrown in native "
 376                                 + "method of thread " + num);
 377                      strace001.testFailed = true;
 378                      return;
 379                  }
 380             } else
 381                 recursionJava(maxDepth, currentDepth);
 382         }
 383 
 384         waitForSign();
 385     } // recursionJava()


 345             log.display("OutOfMemoryError is thrown in thread " + num);
 346         } catch (StackOverflowError e) {
 347             // Recursion is too deep, so exit peacefully
 348             log.display("StackOverflowError is thrown in thread " + num);
 349         }
 350     } // run()
 351 
 352     private void recursionJava(int maxDepth, int currentDepth) {
 353         // A short delay. Otherwise the method will reach the specified depth
 354         // almost instantly
 355         try {
 356             sleep(1);
 357         } catch (InterruptedException e) {
 358             log.complain("Unexpected exception");
 359             e.printStackTrace(log.getOutStream());
 360             strace001.testFailed = true;
 361         }
 362 
 363         currentDepth++;
 364         if (maxDepth > currentDepth) {
 365             Thread.yield();
 366             if (mixed) {
 367                 int result = recursionNative(maxDepth, currentDepth, true);
 368 
 369                  if (result == 1) {
 370                      log.display("Fatal error (OutOfMemoryError or "
 371                                + "StackOverflow) is thrown in native method of "
 372                                + " thread " + num);
 373                      return;
 374                  } else if (result == 2) {
 375                      log.complain("Unexpected exception is thrown in native "
 376                                 + "method of thread " + num);
 377                      strace001.testFailed = true;
 378                      return;
 379                  }
 380             } else
 381                 recursionJava(maxDepth, currentDepth);
 382         }
 383 
 384         waitForSign();
 385     } // recursionJava()
< prev index next >