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 Details

  • Constructor Details

  • Method Details

    • getTransaction

      public TransactionImpl getTransaction()
      Specified by:
      getTransaction in class Transactor<O extends Objectify>
      Returns:
      the transaction appropriate to this transaction state, or null if there is no transaction.
    • transactionless

      public ObjectifyImpl<O> transactionless(ObjectifyImpl<O> parent)
      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 class Transactor<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

      public <R> R execute(ObjectifyImpl<O> parent, TxnType txnType, Work<R> work)
      Specified by:
      execute in class Transactor<O extends Objectify>
      See Also:
      Objectify.execute(TxnType, Work)
    • transact

      public <R> R transact(ObjectifyImpl<O> parent, Work<R> work)
      Specified by:
      transact in class Transactor<O extends Objectify>
      See Also:
      Objectify.transact(Work)
    • transactNew

      public <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. This gives proper transaction isolation.
      Specified by:
      transactNew in class Transactor<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.