code: public void addHandler(Handler handler, Stage stage)
    {
      if (!startStopLock.tryLock()) {
        throw new ISE("Cannot add a handler in the process of Lifecycle starting or stopping");
      }
      try {
        if (!state.get().equals(State.NOT_STARTED)) {
          throw new ISE("Cannot add a handler after the Lifecycle has started, it doesn't work that way.");
        }
        handlers.get(stage).add(handler);
      }
      finally {
        startStopLock.unlock();
      }
    }
docs: Adds a handler to the Lifecycle. If the lifecycle has already been started, it throws an {@link ISE}
  
  @param handler The hander to add to the lifecycle
  @param stage   The stage to add the lifecycle at
  
  @throws ISE indicates that the lifecycle has already been started and thus cannot be added to