< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequestManager/stepRequests/stepreq001t.java

Print this page
*** 21,10 ***
--- 21,11 ---
   * questions.
   */
  
  package nsk.jdi.EventRequestManager.stepRequests;
  
+ import java.lang.reflect.Method;
  import nsk.share.jpda.*;
  import nsk.share.jdi.*;
  
  
  /**

*** 60,11 ***
  // Get a monitor in order to prevent the threads from exiting
          synchronized(lockObj) {
              for (int i=1; i<stepreq001.THRDS_NUM; i++) {
                  thrs[i] = JDIThreadFactory.newThread(new stepreq001a(readyObj, lockObj,
                      stepreq001.DEBUGGEE_THRDS[i]));
!                 thrs[i].setDaemon(stepreq001.DAEMON_THRDS[i]);
                  if (argHandler.verbose())
                      System.out.println("Debuggee: starting thread #"
                          + i + " \"" + thrs[i].getName() + "\"");
                  synchronized(readyObj) {
                      thrs[i].start();
--- 61,13 ---
  // Get a monitor in order to prevent the threads from exiting
          synchronized(lockObj) {
              for (int i=1; i<stepreq001.THRDS_NUM; i++) {
                  thrs[i] = JDIThreadFactory.newThread(new stepreq001a(readyObj, lockObj,
                      stepreq001.DEBUGGEE_THRDS[i]));
!                 if (!isVirtual(thrs[i])) {
+                     thrs[i].setDaemon(stepreq001.DAEMON_THRDS[i]);
+                 }
                  if (argHandler.verbose())
                      System.out.println("Debuggee: starting thread #"
                          + i + " \"" + thrs[i].getName() + "\"");
                  synchronized(readyObj) {
                      thrs[i].start();

*** 107,10 ***
--- 110,19 ---
          }
          return stepreq001.JCK_STATUS_BASE +
              stepreq001.PASSED;
      }
  
+     private static boolean isVirtual(Thread thread) {
+         try {
+             Method isVirtual = Thread.class.getMethod("isVirtual");
+             return (boolean) isVirtual.invoke(thread);
+         } catch (Exception e) {
+             throw new RuntimeException(e);
+         }
+     }
+ 
      class stepreq001a extends NamedTask {
          private Object readyObj;
          private Object lockObj;
  
          stepreq001a(Object readyObj, Object obj,
< prev index next >