code: public final Mono<T> repeatWhenEmpty(int maxRepeat, Function<Flux<Long>, ? extends Publisher<?>> repeatFactory) {
  		return Mono.defer(() -> {
  			Flux<Long> iterations;
  
  			if(maxRepeat == Integer.MAX_VALUE) {
  				iterations = Flux.fromStream(LongStream.range(0, Long.MAX_VALUE).boxed());
  			}
  			else {
  				iterations = Flux
  					.range(0, maxRepeat)
  					.map(Integer::longValue)
  					.concatWith(Flux.error(new IllegalStateException("Exceeded maximum number of repeats"), true));
  			}
  
  			return this.repeatWhen(o -> repeatFactory.apply(o
  						.zipWith(iterations, 1, (c, i) -> i)))
  			           .next();
  		});
  	}
docs: Repeatedly subscribe to this {@link Mono} as long as the current subscription to this
  {@link Mono} completes empty and the companion {@link Publisher} produces an onNext signal.
  <p>
  Any terminal signal will terminate the resulting {@link Mono} with the same signal immediately.
  <p>
  Emits an {@link IllegalStateException} if {@code maxRepeat} is exceeded (provided
  it is different from {@code Integer.MAX_VALUE}).
  
  <p>
  <img class="marble" src="doc-files/marbles/repeatWhenEmpty.svg" alt="">
  
  @param maxRepeat the maximum number of repeats (infinite if {@code Integer.MAX_VALUE})
  @param repeatFactory the {@link Function} that returns the associated {@link Publisher}
  companion, given a {@link Flux} that signals each onComplete as a 0-based incrementing {@link Long}.
  
  @return a {@link Mono} that resubscribes to this {@link Mono} if the previous subscription was empty,
  as long as the companion {@link Publisher} produces an onNext signal and the maximum number of repeats isn't exceeded.