code: private void ensureRunning() {
          Exceptions.checkNotClosed(this.closed.get(), this);
          if (state() != State.RUNNING) {
              throw new IllegalContainerStateException(getId(), state(), State.RUNNING);
          } else if (isOffline()) {
              throw new ContainerOfflineException(getId());
          }
      }
docs: region Helpers