public static InstrumentedScheduledExecutorService newScheduledThreadPool(
            int corePoolSize, MetricRegistry registry, String name) {
        return new InstrumentedScheduledExecutorService(
                Executors.newScheduledThreadPool(corePoolSize), registry, name);
    }
@Test
    public void testNewScheduledThreadPoolWithThreadFactoryAndName() throws Exception {
        final ScheduledExecutorService executorService = InstrumentedExecutors.newScheduledThreadPool(2, defaultThreadFactory, registry, "xs");
        executorService.schedule(new NoopRunnable(), 0, TimeUnit.SECONDS);

        assertThat(registry.meter("xs.scheduled.once").getCount()).isEqualTo(1L);

        final Field delegateField = InstrumentedScheduledExecutorService.class.getDeclaredField("delegate");
        delegateField.setAccessible(true);
        final ScheduledThreadPoolExecutor delegate = (ScheduledThreadPoolExecutor) delegateField.get(executorService);
        assertThat(delegate.getCorePoolSize()).isEqualTo(2);
        assertThat(delegate.getThreadFactory()).isSameAs(defaultThreadFactory);
        executorService.shutdown();
    }