Java: how to abort a thread reading from System.in
Heinz Kabutz’s newsletter shows how to abort System.in reads: import java.io.*; import java.util.concurrent.*; class ConsoleInputReadTask implements Callable<String> { public String call() throws IOException { BufferedReader br = new BufferedReader( new InputStreamReader(System.in)); System.out.println(“ConsoleInputReadTask run() called.”); String input; do { System.out.println(“Please type something: “); try { // wait until we have data to complete a readLine() while … Read more