@Nonnull
    @Override
    public Future<?> submit(@Nonnull Runnable runnable) {
        submitted.mark();
        try {
            return delegate.submit(new InstrumentedRunnable(runnable));
        } catch (RejectedExecutionException e) {
            rejected.mark();
            throw e;
        }
    }
@Test
    public void reportsRejected() throws Exception {
        final BlockingQueue<Runnable> queueCapacityOne = new LinkedBlockingQueue<>(1);
        this.executor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.MILLISECONDS, queueCapacityOne);
        final InstrumentedExecutorService instrumented = new InstrumentedExecutorService(executor, registry, "r");
        final CountDownLatch finish = new CountDownLatch(1);

        final Meter submitted = registry.meter("r.submitted");
        final Counter running = registry.counter("r.running");
        final Meter completed = registry.meter("r.completed");
        final Timer duration = registry.timer("r.duration");
        final Meter rejected = registry.meter("r.rejected");

        assertThat(submitted.getCount()).isEqualTo(0);
        assertThat(running.getCount()).isEqualTo(0);
        assertThat(completed.getCount()).isEqualTo(0);
        assertThat(duration.getCount()).isEqualTo(0);
        assertThat(rejected.getCount()).isEqualTo(0);

        final List<Future<Object>> futures = new ArrayList<>();
        // Start two callables - one to run on thread and one to be added to queue
        for (int i = 0; i < 2; i++) {
            futures.add(instrumented.submit(() -> {
                finish.await();
                return null;
            }));
        }
        try {
            // Attempt to submit third callable - should fail
            instrumented.submit(() -> {
                throw new IllegalStateException("Shouldn't run this task");
            });
            failBecauseExceptionWasNotThrown(RejectedExecutionException.class);
        } catch (RejectedExecutionException e) {
            // Expected
        } finally {
            finish.countDown();
            for (Future future : futures) {
                future.get();
            }
        }

        assertThat(submitted.getCount()).isEqualTo(3);
        assertThat(running.getCount()).isEqualTo(0);
        assertThat(completed.getCount()).isEqualTo(2);
        assertThat(duration.getCount()).isEqualTo(2);
        assertThat(rejected.getCount()).isEqualTo(1);
    }