- Latest (22.3)
- Dev Build
- Java Reference
- Java on Truffle
- Node.js Runtime
- Java Interoperability
- Differences Between Node.js and Java Embeddings
- ScriptEngine Implementation
- LLVM Languages Reference
- Python Reference
- Ruby Reference
- R Reference
- WebAssembly Reference
Context objects, or multiple Worker threads.
Contexts can be created, but they should be used by one thread at a time.
Context cannot be accessed by two or more threads, concurrently, but it is possible to access the same
Context from multiple threads using proper syncronization, to ensure that concurrent access never happens.
Contextobjects can be executed in multiple threads.
Contextcan be accessed from multiple threads when proper synchronization is used.
Multithreading with Node.js #
On the contrary, a Java object created with GraalVM Java interoperability (e.g., using
Java.type()) can be shared between Node.js Workers.
This allows multi-threaded Node.js applications to share Java objects.
The GraalVM Node.js unit tests contain several examples of multi-threaded Node.js applications. The most notable examples show how: