Created
April 19, 2017 23:49
-
-
Save frsyuki/496988df4d4085901106e3409b6ffae1 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
import java.util.Scanner; | |
import javax.script.*; | |
public class ScriptTest { | |
private static volatile boolean stop = false; | |
public static void main(String[] args) { | |
Thread t = new Thread(() -> runLoop()); | |
t.start(); | |
Scanner scan = new Scanner(System.in); | |
scan.nextLine(); | |
stop = true; | |
} | |
public static void runLoop() | |
{ | |
ScriptEngineManager factory = new ScriptEngineManager(); | |
while (!stop) { | |
ScriptEngine engine = factory.getEngineByName("nashorn"); | |
try { | |
engine.eval("'text1' + 'text2'"); // removing this line doesn't cause the issue | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment