예제 #1
0
  @Test
  public void testAbortPolicy() {
    ThreadPoolExecutor threadPoolExecutor =
        new ThreadPoolExecutor(
            1,
            2,
            TestUtil.KEEPALIVE_TIME,
            TimeUnit.MILLISECONDS,
            true,
            3,
            new AbortPolicy(),
            Executors.defaultThreadFactory(),
            new ThreadPoolHandlerAdapter());

    threadPoolExecutor.shutdown();

    try {
      threadPoolExecutor.execute(new MarkerBlockingJob());

      Assert.fail();
    } catch (RejectedExecutionException ree) {
    }
  }
 @Override
 protected void finalize() {
   shutdown();
 }