DefaultContainerThreadpool extends AbstractComponent implements AutoCloseable, ContainerThreadPool { @Override public Executor executor() { return threadpool; } @Inject  DefaultContainerThreadpool(ContainerThreadpoolConfig config, Metric metric);  DefaultContainerThreadpool(ContainerThreadpoolConfig config, Metric metric, ProcessTerminator processTerminator); @Override Executor executor(); @Override void close(); @Override void deconstruct();  }
@Test @Ignore public void testThreadPoolTerminationOnBreakdown() throws InterruptedException { ContainerThreadpoolConfig config = new ContainerThreadpoolConfig( new ContainerThreadpoolConfig.Builder() .maxThreads(2) .maxThreadExecutionTimeSeconds(1)); MockProcessTerminator terminator = new MockProcessTerminator(); ContainerThreadPool threadPool = new DefaultContainerThreadpool(config, Mockito.mock(Metric.class), terminator); threadPool.executor().execute(new Hang(500)); threadPool.executor().execute(new Hang(500)); assertEquals(0, terminator.dieRequests); assertRejected(threadPool, new Hang(500)); assertEquals(0, terminator.dieRequests); try { Thread.sleep(1500); } catch (InterruptedException e) {} threadPool.executor().execute(new Hang(1)); assertEquals(0, terminator.dieRequests); try { Thread.sleep(50); } catch (InterruptedException e) {} threadPool.executor().execute(new Hang(2000)); threadPool.executor().execute(new Hang(2000)); assertEquals(0, terminator.dieRequests); assertRejected(threadPool, new Hang(2000)); assertEquals(0, terminator.dieRequests); try { Thread.sleep(1500); } catch (InterruptedException e) {} assertRejected(threadPool, new Hang(2000)); assertEquals(1, terminator.dieRequests); }