vt

Virtual-thread task execution utilities.

This module provides a shared Java virtual-thread executor and exposes a
method for submitting JavaScript functions as Java Callable tasks.

Methods

(static) submit(callableFn) → {java.util.concurrent.Future}

Submits a JavaScript function for execution in a new Java virtual thread.

The returned Java Future can be used to wait for completion, obtain the
task result, cancel the task, or inspect its execution state.

Parameters:
Name Type Description
callableFn VirtualThreadTask

JavaScript function to execute. Blocking operations are allowed.

Returns:

Java Future representing the submitted task.

Type
Future

Type Definitions

VirtualThreadTask() → {*}

A JavaScript function submitted to the virtual-thread executor.

The function may perform blocking operations. Its return value becomes the
result returned by Future.get().

Returns:

The task result.

Type
*