DefaultTaskExecutors { static ExecutorService createDefaultDeleteExecutor() { return PTExecutors.newThreadPoolExecutor( SINGLE_THREAD, SINGLE_THREAD, DEFAULT_IDLE_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(DEFAULT_QUEUE_CAPACITY), new NamedThreadFactory("atlas-delete-executor", true), new ThreadPoolExecutor.AbortPolicy()); } private  DefaultTaskExecutors();   }
@Test public void deleteExecutorHasBoundedTaskQueue() { ExecutorService service = DefaultTaskExecutors.createDefaultDeleteExecutor(); for (int i = 0; i < DefaultTaskExecutors.DEFAULT_QUEUE_CAPACITY + 1; i++) { service.submit(() -> { Uninterruptibles.sleepUninterruptibly(1, TimeUnit.DAYS); return 1; }); } assertThatThrownBy(() -> service.submit(() -> 0)).isInstanceOf(RejectedExecutionException.class) .hasMessageContaining("rejected from"); }