Interface ResourceReloader.Synchronizer

Enclosing interface:
ResourceReloader

public static interface ResourceReloader.Synchronizer
A synchronizer to indicate completion of a reloader's prepare stage and to allow start of the apply stage only if all reloaders have finished the prepare stage.
  • Method Summary

    Modifier and Type Method Description
    <T> CompletableFuture<T> whenPrepared​(T preparedObject)
    Indicates, to the ongoing reload, that this reloader has finished its preparation stage with the preparedObject as its result.
  • Method Details

    • whenPrepared

      <T> CompletableFuture<T> whenPrepared​(T preparedObject)
      Indicates, to the ongoing reload, that this reloader has finished its preparation stage with the preparedObject as its result.

      Returns a completable future that the apply stage depends on. This returned future is completed when all the reloaders have completed their prepare stages in the reload.

      Example: CompletableFuture<SomeObject> prepareStage = ...; prepareStage.thenCompose(synchronizer::whenPrepared) .thenAcceptAsync(..., applyExecutor);

      Parameters:
      preparedObject - the result of the prepare stage
      Returns:
      a completable future as the precondition for the apply stage