### Question:
InlineExecutorService extends AbstractExecutorService { @Override public List<Runnable> shutdownNow() { shutdown(); myLock.lock(); try { for (Thread thread : myThreads) { thread.interrupt(); } } finally { myLock.unlock(); } return Collections.emptyList(); } InlineExecutorService(); @Override boolean awaitTermination(long timeout, TimeUnit unit); @Override final void execute(Runnable command); @Override boolean isShutdown(); @Override boolean isTerminated(); @Override void shutdown(); @Override List<Runnable> shutdownNow();  }### Answer:
@Test public void testShutdownNow() throws InterruptedException { ExecutorService pool = Executors.newFixedThreadPool(2); final CountDownLatch latch = new CountDownLatch(2); final AtomicBoolean flag1 = new AtomicBoolean(); final AtomicBoolean flag2 = new AtomicBoolean(); final ExecutorService service = new InlineExecutorService(); pool.execute(new TestRunnable(service, latch, flag1, 5000L)); pool.execute(new TestRunnable(service, latch, flag2, 5000L)); latch.await(); Assert.assertFalse(service.isShutdown()); service.shutdownNow(); Assert.assertTrue(service.isShutdown()); Assert.assertTrue(service.awaitTermination(1000L, TimeUnit.MILLISECONDS)); Assert.assertTrue(flag1.get()); Assert.assertTrue(flag2.get()); }