Say I started a topic and I have something like this:
...//initiate all the socket connection future = executor.submit ( new Runnable() { public void run() { ... ... while ((str = in.readLine()) != null) { //do something here } } );
executor is an ExecutorService object and is a BufferedReader object
I know that you can close a socket from another thread to interrupt this thread. But when I try to use the future.cancel (true) method, although it returns true, the thread seems to be still running, does anyone know why? or in.readLine () cannot be interrupted this way?
source share