I have the following code
ExecutorService es = Executors.newSingleThreadExecutor(); es.submit(new Runnable() { @Override public void run()
Please try this
ExecutorService es = Executors.newSingleThreadExecutor(); es.submit(new Runnable() { @Override public void run() { try{ while(true); }catch(InterruptException){ Thread.currentThread().interrupt(); } }
}); es.shutdownNow();