com.google.appengine.api.datastore
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 Summary
 void commit()
          Commits the transaction.
 java.util.concurrent.Future<java.lang.Void> commitAsync()
          An asynchronous implementation of commit().
 java.lang.String getApp()
           
 java.lang.String getId()
           
 boolean isActive()
           
 void rollback()
          Rolls back the transaction.
 java.util.concurrent.Future<java.lang.Void> rollbackAsync()
          An asynchronous implementation of rollback().
 

Method Detail

commit

void commit()
Commits the transaction. Whether this call succeeds or fails, all subsequent method invocations on this object will throw IllegalStateException.

Throws:
java.lang.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.
ConcurrentModificationException - If some other transaction modified the same entity groups concurrently.

commitAsync

java.util.concurrent.Future<java.lang.Void> commitAsync()
An asynchronous implementation of commit().

Returns:
A Future associated with the call.
See Also:
commit()

rollback

void rollback()
Rolls back the transaction. Whether this call succeeds or fails, all subsequent method invocations on this object will throw IllegalStateException.

Throws:
java.lang.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

java.util.concurrent.Future<java.lang.Void> rollbackAsync()
An asynchronous implementation of rollback().

Returns:
A Future associated with the call.
See Also:
rollback()

getId

java.lang.String getId()
Returns:
The globally unique identifier for the Transaction.

getApp

java.lang.String getApp()
Returns:
The application id for the Transaction.

isActive

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