public interface LockBasedTransaction
Describes the set of operations that AbstractLockBasedProxyManager typically performs in reaction to user request. The typical flow is following:
  1. begin - begin(Optional)
  2. lock - lockAndGet(Optional)
  3. update - update(byte[], RemoteBucketState, Optional)
  4. unlock - unlock()
  5. commit - commit(Optional)
  6. 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
    create(byte[] data, RemoteBucketState state, Optional<Long> timeoutNanos)
    Creates the data by the key associated with this transaction.
    byte[]
    lockAndGet(Optional<Long> timeoutNanos)
    Locks data by the key associated with this transaction and returns data that is associated with the key.
    void
    Frees resources associated with this transaction
    void
    Rollbacks transaction if underlying storage requires transactions
    void
    Unlocks data by the key associated with this transaction.
    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
    • lockAndGet

      byte[] lockAndGet(Optional<Long> timeoutNanos)
      Locks data by the key associated with this transaction and returns data that is associated with the key. There is strong guarantee that unlock() will be called if lockAndGet(Optional) returns successfully.
      Parameters:
      timeoutNanos - optional timeout in nanoseconds
      Returns:
      Returns the data by the key associated with this transaction, or null data associated with key does not exist
    • unlock

      void unlock()
      Unlocks data by the key associated with this transaction.
    • create

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

      void release()
      Frees resources associated with this transaction