code: public void addShutdownHook(final Runnable task) {
          if (inEventLoop()) {
              shutdownHooks.add(task);
          } else {
              execute(new Runnable() {
                  @Override
                  public void run() {
                      shutdownHooks.add(task);
                  }
              });
          }
      }
docs: Add a {@link Runnable} which will be executed on shutdown of this instance