< prev index next >

test/lib/jdk/test/lib/thread/VThreadRunner.java

Print this page

 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */
 23 
 24 package jdk.test.lib.thread;
 25 
 26 import java.lang.reflect.Field;
 27 import java.time.Duration;
 28 import java.util.concurrent.ForkJoinPool;
 29 import java.util.concurrent.atomic.AtomicReference;
 30 
 31 /**
 32  * Helper class to support tests running tasks a in virtual thread.
 33  */
 34 public class VThreadRunner {
 35     private VThreadRunner() { }
 36 
 37     /**
 38      * Characteristic value signifying that initial values for inheritable
 39      * thread locals are not inherited from the constructing thread.
 40      */
 41     public static final int NO_INHERIT_THREAD_LOCALS = 1 << 2;
 42 
 43     /**
 44      * Represents a task that does not return a result but may throw
 45      * an exception.
 46      */
 47     @FunctionalInterface
 48     public interface ThrowingRunnable {
 49         /**
 50          * Runs this operation.
 51          */
 52         void run() throws Exception;

 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */
 23 
 24 package jdk.test.lib.thread;
 25 
 26 import java.lang.reflect.Field;
 27 import java.time.Duration;
 28 import java.util.concurrent.ForkJoinPool;
 29 import java.util.concurrent.atomic.AtomicReference;
 30 
 31 /**
 32  * Helper class to support tests running tasks in a virtual thread.
 33  */
 34 public class VThreadRunner {
 35     private VThreadRunner() { }
 36 
 37     /**
 38      * Characteristic value signifying that initial values for inheritable
 39      * thread locals are not inherited from the constructing thread.
 40      */
 41     public static final int NO_INHERIT_THREAD_LOCALS = 1 << 2;
 42 
 43     /**
 44      * Represents a task that does not return a result but may throw
 45      * an exception.
 46      */
 47     @FunctionalInterface
 48     public interface ThrowingRunnable {
 49         /**
 50          * Runs this operation.
 51          */
 52         void run() throws Exception;
< prev index next >