@Test public void asyncTask() throws InterruptedException { final CountDownLatch countDownLatch = new CountDownLatch(1); final LongTask longTask = new LongTask(1, 50, countDownLatch); factoryService.asyncTask(longTask); countDownLatch.await(200, TimeUnit.MILLISECONDS); LOGGER.info("task was completed"); assertEquals(2, longTask.getResult()); }
public void asyncTask(final LongTask longTask) throws InterruptedException { LOGGER.info("Create asyncTask"); final Thread thread = factory.newThread(longTask); thread.setName("pretty asyncTask"); thread.start(); }
ThreadFactoryService { public void asyncTask(final LongTask longTask) throws InterruptedException { LOGGER.info("Create asyncTask"); final Thread thread = factory.newThread(longTask); thread.setName("pretty asyncTask"); thread.start(); } }
ThreadFactoryService { public void asyncTask(final LongTask longTask) throws InterruptedException { LOGGER.info("Create asyncTask"); final Thread thread = factory.newThread(longTask); thread.setName("pretty asyncTask"); thread.start(); }  }
ThreadFactoryService { public void asyncTask(final LongTask longTask) throws InterruptedException { LOGGER.info("Create asyncTask"); final Thread thread = factory.newThread(longTask); thread.setName("pretty asyncTask"); thread.start(); }  void asyncTask(final LongTask longTask); void asyncHangingTask(final Runnable longTask); }
ThreadFactoryService { public void asyncTask(final LongTask longTask) throws InterruptedException { LOGGER.info("Create asyncTask"); final Thread thread = factory.newThread(longTask); thread.setName("pretty asyncTask"); thread.start(); }  void asyncTask(final LongTask longTask); void asyncHangingTask(final Runnable longTask);  }