@Test public void asyncHangingTask() throws InterruptedException { final CountDownLatch countDownLatch = new CountDownLatch(1); final LongTask longTask = new LongTask(1, 1000000, countDownLatch); factoryService.asyncHangingTask(longTask); countDownLatch.await(200, TimeUnit.MILLISECONDS); LOGGER.info("task should have been interrupted and its operation not completed."); assertTrue(longTask.getIsTerminated()); }
public void asyncHangingTask(final Runnable longTask) { LOGGER.info("Create asyncHangingTask"); final Thread thread = factory.newThread(longTask); thread.setName("pretty asyncHangingTask"); thread.start(); if (thread.isAlive()) { thread.interrupt(); } }
ThreadFactoryService { public void asyncHangingTask(final Runnable longTask) { LOGGER.info("Create asyncHangingTask"); final Thread thread = factory.newThread(longTask); thread.setName("pretty asyncHangingTask"); thread.start(); if (thread.isAlive()) { thread.interrupt(); } } }
ThreadFactoryService { public void asyncHangingTask(final Runnable longTask) { LOGGER.info("Create asyncHangingTask"); final Thread thread = factory.newThread(longTask); thread.setName("pretty asyncHangingTask"); thread.start(); if (thread.isAlive()) { thread.interrupt(); } }  }
ThreadFactoryService { public void asyncHangingTask(final Runnable longTask) { LOGGER.info("Create asyncHangingTask"); final Thread thread = factory.newThread(longTask); thread.setName("pretty asyncHangingTask"); thread.start(); if (thread.isAlive()) { thread.interrupt(); } }  void asyncTask(final LongTask longTask); void asyncHangingTask(final Runnable longTask); }
ThreadFactoryService { public void asyncHangingTask(final Runnable longTask) { LOGGER.info("Create asyncHangingTask"); final Thread thread = factory.newThread(longTask); thread.setName("pretty asyncHangingTask"); thread.start(); if (thread.isAlive()) { thread.interrupt(); } }  void asyncTask(final LongTask longTask); void asyncHangingTask(final Runnable longTask);  }