code: private void doStop(Throwable cause) {
          long traceId = LoggerHelpers.traceEnterWithContext(log, traceObjectId, "doStop");
          log.info("{}: Stopping.", this.traceObjectId);
          CompletableFuture.allOf(
                  Services.stopAsync(this.metadataCleaner, this.executor),
                  Services.stopAsync(this.writer, this.executor),
                  Services.stopAsync(this.durableLog, this.executor))
                  .whenCompleteAsync((r, ex) -> {
                      Throwable failureCause = getFailureCause(this.durableLog, this.writer, this.metadataCleaner);
                      if (failureCause == null) {
                          failureCause = cause;
                      } else if (cause != null && failureCause != cause) {
                          failureCause.addSuppressed(cause);
                      }
  
                      if (failureCause == null) {
                          // Normal shutdown
                          log.info("{}: Stopped.", this.traceObjectId);
                          LoggerHelpers.traceLeave(log, traceObjectId, "doStop", traceId);
                          notifyStopped();
                      } else {
                          // Shutting down due to failure.
                          log.warn("{}: Failed due to component failure.", this.traceObjectId);
                          LoggerHelpers.traceLeave(log, traceObjectId, "doStop", traceId);
                          notifyFailed(failureCause);
                      }
                  }, this.executor)
                  .exceptionally(ex -> {
                      notifyFailed(ex);
                      return null;
                  });
      }
docs: Stops the StreamSegmentContainer by stopping all components, waiting for them to stop, and reports a normal
  shutdown or failure based on case. It will report a normal shutdown only if all components shut down normally
  and cause is null. Otherwise, the container will report either the exception of the failed component, or the
  given cause.
  
  @param cause (Optional) The failure cause. If any of the components failed as well, this will be added as a
  suppressed exception to the Service's failure cause.