Package com.googlecode.objectify.impl
Class TransactorYes<O extends Objectify>
java.lang.Object
com.googlecode.objectify.impl.Transactor<O>
com.googlecode.objectify.impl.TransactorYes<O>
public class TransactorYes<O extends Objectify> extends Transactor<O>
Implementation for when we start a transaction. Maintains a separate session, but then copies all
data into the original session on successful commit.
- Author:
- Jeff Schnitzer
-
Field Summary
Modifier and TypeFieldDescriptionprotected TransactorNo<O>
The non-transactional transactor that spawned usprotected Result<TransactionImpl>
Our transaction.Fields inherited from class com.googlecode.objectify.impl.Transactor
deferrer, session
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Called when the associated transaction is committed.<R> R
execute(ObjectifyImpl<O> parent, TxnType txnType, Work<R> work)
<R> R
transact(ObjectifyImpl<O> parent, Work<R> work)
transactionless(ObjectifyImpl<O> parent)
This version goes back to life without a transaction, but preserves current state regarding deadline, consistency, etc.<R> R
transactNew(ObjectifyImpl<O> parent, int limitTries, Work<R> work)
We need to make sure the parentSession is the transactionless session, not the session for our transaction.Methods inherited from class com.googlecode.objectify.impl.Transactor
getDeferrer, getSession
-
Field Details
-
transaction
Our transaction. -
parentTransactor
The non-transactional transactor that spawned us
-
-
Constructor Details
-
TransactorYes
-
-
Method Details
-
getTransaction
- Specified by:
getTransaction
in classTransactor<O extends Objectify>
- Returns:
- the transaction appropriate to this transaction state, or null if there is no transaction.
-
transactionless
This version goes back to life without a transaction, but preserves current state regarding deadline, consistency, etc. We use the session from the parent, ie life before transactions.- Specified by:
transactionless
in classTransactor<O extends Objectify>
- Parameters:
parent
- is the parent objectify instance; the one being transitioned from- Returns:
- an Objectify instance that is suitable for transactionless execution. In the case of a transactor which is not in a transaction, probably this is the same as getObjectify().
-
execute
- Specified by:
execute
in classTransactor<O extends Objectify>
- See Also:
Objectify.execute(TxnType, Work)
-
transact
- Specified by:
transact
in classTransactor<O extends Objectify>
- See Also:
Objectify.transact(Work)
-
transactNew
We need to make sure the parentSession is the transactionless session, not the session for our transaction. This gives proper transaction isolation.- Specified by:
transactNew
in classTransactor<O extends Objectify>
- See Also:
Objectify.transactNew(int, Work)
-
committed
public void committed()Called when the associated transaction is committed. Dumps the contents of the transactional session into the parent's session.
-