@ManagedOperation
    public void terminate() {
        if (state.get() == State.TERMINATED) {
            throw new IllegalStateException("Unable to terminate service with state " + state);
        }
        state.set(State.TERMINATED);
    }