Interface AsyncCompareAndSwapOperation


  • public interface AsyncCompareAndSwapOperation
    Describes the set of operations that AbstractCompareAndSwapBasedProxyManager typically performs in reaction to user request. The typical flow is following:
    1. getStateData - getStateData()
    2. compareAndSwap - #compareAndSwap(byte[], byte[])
    3. Return to first step if CAS was unsuccessful
    • Method Detail

      • getStateData

        CompletableFuture<Optional<byte[]>> getStateData()
        Reads data if it exists
        Returns:
        persisted data or empty optional if data not exists
      • compareAndSwap

        CompletableFuture<Boolean> compareAndSwap​(byte[] originalData,
                                                  byte[] newData,
                                                  RemoteBucketState newState)
        Compares and swap data associated with key
        Parameters:
        originalData - previous bucket state(can be null).
        newData - new bucket state
        newState - new state of bucket - can be used to extract additional data is useful for persistence or logging.
        Returns:
        true if data changed, false if another parallel transaction achieved success instead of current transaction