-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Class/Context factory support for ScriptEngine #734
Comments
Hi, Thank you for reporting this. Please take a look at this: Multithreading |
Thanks @oubidar-Abderrahim, but this wiki page does not answer my question. My issue is that we create some classes in our Javascript code that are called by another framework (Kafka Streams). We could not find a way to synchronize these threads or create on context per thread. |
Hi @iamstolis can you take a look into this please? |
No. You should not use the same (
If I understand correctly then your problem is that some framework is using |
@iamstolis, I'm not sure if you understand correctly.
No. We have a framework using ScriptEngine that does not create the threads, it provides some classes that will be used by other threads. The threads are created by another framework, in our case Kafka Streams. In my sample, I have the |
Description
I'm replacing Nashorn with graaljs in a Kafka Stream framework as a hookpoint engine. It's working fine for some of our extension points, but we have an extension point to configure some Kafka Stream steps.
This is the code we are using to test our implementation:
Our issue happens because after executing the execution Kafka Stream creates some threads and tries to call the created objects inside the javascript code. Then we have the exception bellow because more than one thread is accessing the same context simultaneously.
This is the way we instantiate our script engine:
Is there a way to provide Class (or Context) factory to avoid using the same context in different threads?
Environment
GraalVM JS version: 21.3.6
Java version: OpenJDK 8
The text was updated successfully, but these errors were encountered: