Last active
February 11, 2019 15:54
-
-
Save eleinadani/037b2999c890c32e7d72ac770696d29a 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 cx = Context.create("js"); | |
Value jsCode = cx.eval("js", "(function(x,y) { return JSON.stringify({x:x,y:y}); })"); | |
Thread thread = new Thread(new Runnable() { | |
@Override | |
public void run() { | |
while (true) { | |
synchronized (cx) { | |
jsCode.execute(42,43).asString(); | |
} | |
} | |
} | |
}); | |
thread.start(); | |
while (true) { | |
synchronized (cx) { | |
jsCode.execute(44,45).asString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment