public static <SuccessT, PromiseT> BiConsumer<SuccessT, ? super Throwable> promiseNotifyingBiConsumer(
      Function<SuccessT, PromiseT> successFunction, Promise<PromiseT> promise) {
    return (success, fail) -> {
      if (fail != null) {
        promise.setFailure(fail);
      } else {
        try {
          promise.setSuccess(successFunction.apply(success));
        } catch (Throwable e) {
          promise.setFailure(e);
        }
      }
    };
  }
Creates a {@link BiConsumer} that notifies the promise of any failures either via the {@link Throwable} passed into the
BiConsumer of as a result of running the successFunction.

@param successFunction Function called to process the successful result and map it into the result to notify the promise
with.
@param promise Promise to notify of success or failure.
@param <SuccessT> Success type.
@param <PromiseT> Type being fulfilled by the promise.
@return BiConsumer that can be used in a {@link CompletableFuture#whenComplete(BiConsumer)} method.
ambry-commons/src/main/java/com/github/ambry/commons/NettyUtils.java