Interface Transaction


public interface Transaction
Describes a logical unit of work to be performed against the datastore. Operations performed as part of a single Transaction succeed or fail as a unit. Transactions can be committed and rolled back synchronously and asynchronously.
  • Method Details

    • commit

      void commit()
      Commits the transaction. Whether this call succeeds or fails, all subsequent method invocations on this object will throw IllegalStateException.
      Throws:
      IllegalStateException - If the transaction has already been committed, rolled back, a commit or a rollback is in progress (via an async call), or an attempt to commit or roll back has already failed. If there are any outstanding async datastore calls when this method is invoked, this method will block on the completion of those calls before proceeding. If any of those outstanding calls fails, the exception from the first failing call will be thrown.
      DatastoreFailureException - If a datastore error occurs.
      ConcurrentModificationException - If some other transaction modified the same entity groups concurrently.
    • commitAsync

      Future<Void> commitAsync()
      An asynchronous implementation of commit().
      Returns:
      A Future associated with the call.
      See Also:
    • rollback

      void rollback()
      Rolls back the transaction. Whether this call succeeds or fails, all subsequent method invocations on this object will throw IllegalStateException.
      Throws:
      IllegalStateException - If the transaction has already been committed, rolled back, a commit or a rollback is in progress (via an async call), or an attempt to commit or roll back has already failed. If there are any outstanding async datastore calls when this method is invoked, this method will block on the completion of those calls before proceeding.
      DatastoreFailureException - If a datastore error occurs.
    • rollbackAsync

      Future<Void> rollbackAsync()
      An asynchronous implementation of rollback().
      Returns:
      A Future associated with the call.
      See Also:
    • getId

      String getId()
      Returns:
      The globally unique identifier for the Transaction.
    • getApp

      String getApp()
      Returns:
      The application id for the Transaction.
    • isActive

      boolean isActive()
      Returns:
      true if the transaction is active, false otherwise.