< prev index next >

src/jdk.jdi/share/classes/com/sun/jdi/ThreadReference.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this
--- 1,7 ---
  /*
!  * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this

*** 24,12 ***
   */
  
  package com.sun.jdi;
  
  import java.util.List;
- 
  import com.sun.jdi.event.EventSet;
  
  /**
   * A thread object from the target VM.
   * A ThreadReference is an {@link ObjectReference} with additional
   * access to thread-specific information from the target VM.
--- 24,12 ---
   */
  
  package com.sun.jdi;
  
  import java.util.List;
  import com.sun.jdi.event.EventSet;
+ import jdk.internal.javac.PreviewFeature;
  
  /**
   * A thread object from the target VM.
   * A ThreadReference is an {@link ObjectReference} with additional
   * access to thread-specific information from the target VM.

*** 45,15 ***
      public final int THREAD_STATUS_UNKNOWN  =-1;
      /** Thread has completed execution */
      public final int THREAD_STATUS_ZOMBIE = 0;
      /** Thread is runnable */
      public final int THREAD_STATUS_RUNNING = 1;
!     /** Thread is sleeping - Thread.sleep() or JVM_Sleep() was called */
      public final int THREAD_STATUS_SLEEPING = 2;
      /** Thread is waiting on a java monitor */
      public final int THREAD_STATUS_MONITOR = 3;
!     /** Thread is waiting - Object.wait() or JVM_MonitorWait() was called */
      public final int THREAD_STATUS_WAIT = 4;
      /** Thread has not yet been started */
      public final int THREAD_STATUS_NOT_STARTED = 5;
  
      /**
--- 45,18 ---
      public final int THREAD_STATUS_UNKNOWN  =-1;
      /** Thread has completed execution */
      public final int THREAD_STATUS_ZOMBIE = 0;
      /** Thread is runnable */
      public final int THREAD_STATUS_RUNNING = 1;
!     /** Thread is sleeping - {@link Thread#sleep(long)}. */
      public final int THREAD_STATUS_SLEEPING = 2;
      /** Thread is waiting on a java monitor */
      public final int THREAD_STATUS_MONITOR = 3;
!     /** Thread is waiting - {@link Object#wait()} or
+      * {@link java.util.concurrent.locks.LockSupport#park()}.
+      * A virtual thread that is sleeping in {@link Thread#sleep(long)} may
+      * have this thread status instead of {@link #THREAD_STATUS_SLEEPING}. */
      public final int THREAD_STATUS_WAIT = 4;
      /** Thread has not yet been started */
      public final int THREAD_STATUS_NOT_STARTED = 5;
  
      /**

*** 471,6 ***
--- 474,21 ---
       */
      void forceEarlyReturn(Value value) throws InvalidTypeException,
                                                ClassNotLoadedException,
                                                IncompatibleThreadStateException;
  
+     /**
+      * Returns {@code true} if the thread is a
+      * <a href="{@docRoot}/java.base/java/lang/Thread.html#virtual-threads">virtual thread</a>.
+      *
+      * @return true if the thread is a virtual thread
+      *
+      * @implSpec
+      * The default implementation throws {@code UnsupportedOperationException}.
+      *
+      * @since 99
+      */
+     @PreviewFeature(feature = PreviewFeature.Feature.VIRTUAL_THREADS)
+     default boolean isVirtual() {
+         throw new UnsupportedOperationException("Method not implemented");
+     }
  }
< prev index next >