Top Description Constructors Methods
org.h2.util

public final Class Utils21

extends Object
Class Inheritance

Utilities with specialized implementations for Java 21 and later versions. This class contains basic implementations for older versions of Java and it is overridden in multi-release JARs.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Thread

Returns:

a new thread
newVirtualThread
(Runnable
the object to run
task
)

Creates a new virtual thread (on Java 21+) for the specified task.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Utils21back to summary
private Utils21()

Method Detail

newVirtualThreadback to summary
public static Thread newVirtualThread(Runnable task)

Creates a new virtual thread (on Java 21+) for the specified task. Use Thread#start() to schedule the thread to execute. On older versions of Java a platform daemon thread is created instead.

Parameters
task:Runnable

the object to run

Returns:Thread

a new thread