public void register(GracefulShutdownHook shutdownHook) {
        if (isShuttingDown.get()) {
            // Avoid any changes to the shutdown hooks set when the shutdown is already in progress
            throw new IllegalStateException("Couldn't register shutdown hook because shutdown is already in progress");
        }
        shutdownHooks.add(requireNonNull(shutdownHook, "shutdownHook cannot be null"));
    }
@Test
    public void registerMoreThanOnce() throws Exception {
        final AtomicInteger value = new AtomicInteger(0);

        final GracefulShutdownHook hook = value::incrementAndGet;

        shutdownService.register(hook);
        shutdownService.register(hook);
        shutdownService.register(hook);

        assertThat(value.get()).isEqualTo(0);

        stop(shutdownService);

        assertThat(value.get()).isEqualTo(1);
    }