Interface AsyncOptimizationController

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      CompletableFuture<Void> syncByCondition​(long unsynchronizedTokens, Duration timeSinceLastSync)
      Initiates immediate synchronization of local copy of bucket with remote storage in case of both conditions bellow are true: Accumulated amount of locally consumed tokens without external synchronization is greater than or equal to unsynchronizedTokens Time passed since last synchronization with external storage is greater than or equal to timeSinceLastSync
      default CompletableFuture<Void> syncImmediately()
      Initiates immediate synchronization of local copy of bucket with remote storage
    • Method Detail

      • syncImmediately

        default CompletableFuture<Void> syncImmediately()
        Initiates immediate synchronization of local copy of bucket with remote storage
        Returns:
        future that will be completed when local copy of bucket will be synchronized with remote storage, or immediately completed future in case of this synchronization is not required.
      • syncByCondition

        CompletableFuture<Void> syncByCondition​(long unsynchronizedTokens,
                                                Duration timeSinceLastSync)
        Initiates immediate synchronization of local copy of bucket with remote storage in case of both conditions bellow are true:
        • Accumulated amount of locally consumed tokens without external synchronization is greater than or equal to unsynchronizedTokens
        • Time passed since last synchronization with external storage is greater than or equal to timeSinceLastSync
        Parameters:
        unsynchronizedTokens - criterion for accumulated amount of unsynchronized tokens
        timeSinceLastSync - criterion for time passed since last synchronization
        Returns:
        future that will be completed when local copy of bucket will be synchronized with remote storage, or immediately completed future in case of this synchronization is not required.