code: public static synchronized void addOperation(Runnable runnable, boolean preserveForNextShutdown) {
          shutdownOperations.add(runnable);
          if(preserveForNextShutdown) {
              preservedShutdownOperations.add(runnable);
          }
      }
docs: Adds a shutdown operation
  @param runnable The runnable operation
  @param preserveForNextShutdown should preserve the operation for subsequent shutdowns, useful in tests