Interface SelectForUpdateBasedTransaction


public interface SelectForUpdateBasedTransaction
Describes the set of operations that AbstractSelectForUpdateBasedProxyManager typically performs in reaction to user request. The typical flow is following:
  1. begin - begin(Optional)
  2. lock - tryLockAndGet(Optional)
  3. update - update(byte[],RemoteBucketState,Optional)
  4. commit - commit(Optional)
  5. release - release()
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    begin(Optional<Long> timeoutNanos)
    Begins transaction if underlying storage requires transactions.
    void
    commit(Optional<Long> timeoutNanos)
    Commits transaction if underlying storage requires transactions
    void
    Frees resources associated with this transaction
    void
    Rollbacks transaction if underlying storage requires transactions
    boolean
    Creates empty data by for the key associated with this transaction.
    tryLockAndGet(Optional<Long> timeoutNanos)
    Locks data by the key associated with this transaction and returns data that is associated with the key.
    void
    update(byte[] data, RemoteBucketState newState, Optional<Long> timeoutNanos)
    Updates the data by the key associated with this transaction.
  • Method Details

    • begin

      void begin(Optional<Long> timeoutNanos)
      Begins transaction if underlying storage requires transactions. There is strong guarantee that commit(Optional) or rollback() will be called if begin(Optional) returns successfully.
      Parameters:
      timeoutNanos - optional timeout in nanoseconds
    • rollback

      void rollback()
      Rollbacks transaction if underlying storage requires transactions
    • commit

      void commit(Optional<Long> timeoutNanos)
      Commits transaction if underlying storage requires transactions
      Parameters:
      timeoutNanos - optional timeout in nanoseconds
    • tryLockAndGet

      LockAndGetResult tryLockAndGet(Optional<Long> timeoutNanos)
      Locks data by the key associated with this transaction and returns data that is associated with the key.
      Parameters:
      timeoutNanos - optional timeout in nanoseconds
      Returns:
      the data by the key associated with this transaction, or null data associated with key does not exist
    • tryInsertEmptyData

      boolean tryInsertEmptyData(Optional<Long> timeoutNanos)
      Creates empty data by for the key associated with this transaction. This operation is required to be able to lock data in the scope of next transaction.
      Parameters:
      timeoutNanos - optional timeout in nanoseconds
      Returns:
      true if data has been inserted
    • update

      void update(byte[] data, RemoteBucketState newState, Optional<Long> timeoutNanos)
      Updates the data by the key associated with this transaction.
      Parameters:
      data - bucket state to persists
      newState - new state of bucket - can be used to extract additional data is useful for persistence or logging.
      timeoutNanos - optional timeout in nanoseconds
    • release

      void release()
      Frees resources associated with this transaction