Last active
February 5, 2019 16:14
-
-
Save eleinadani/46330147704d75e38c9e879b6b818489 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context c1 = Context.create("js"); | |
Context c2 = Context.create("js"); | |
String jsCode = "(function(x,y) { return JSON.stringify({x:x,y:y}); })"; | |
Value json1 = c1.eval("js", jsCode); | |
Value json2 = c2.eval("js", jsCode); | |
Thread thread = new Thread(new Runnable() { | |
@Override | |
public void run() { | |
while (true) { | |
json1.execute(42,43).asString(); | |
} | |
} | |
}); | |
thread.start(); | |
while (true) { | |
json2.execute(44,45).asString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment