Class TransactionImpl

    • Field Detail

      • active

        protected boolean active
        Whether the transaction is active.
      • committing

        protected boolean committing
        Flag for whether we are currently committing.
      • rollbackOnly

        protected boolean rollbackOnly
        Whether the transaction is only for roll-back.
      • serializeRead

        protected Boolean serializeRead
        Whether to serialise (lock) any read objects in this transaction.
      • closed

        protected boolean closed
    • Constructor Detail

      • TransactionImpl

        public TransactionImpl​(ExecutionContext ec,
                               PropertyStore properties)
        Constructor for a transaction for the specified ExecutionContext.
        Parameters:
        ec - ExecutionContext
        properties - Properties to use with the transaction
    • Method Detail

      • getBeginTime

        public long getBeginTime()
        Description copied from interface: Transaction
        Accessor for the time (millisecs) from System.currentTimeMillis when the transaction started.
        Specified by:
        getBeginTime in interface Transaction
        Returns:
        Time at which the transaction started. -1 implies not yet started.
      • close

        public void close()
        Description copied from interface: Transaction
        Method to inform the transaction that it is closed. This is only necessary for JBoss usage of JPA where it doesn't bother calling afterCompletion on the JTA txn until after it closes the EntityManager so we need a hook to inform the transaction that it is closed so ignore any subsequent afterCompletion.
        Specified by:
        close in interface Transaction
      • begin

        public void begin()
        Method to begin the transaction.
        Specified by:
        begin in interface Transaction
      • internalBegin

        protected void internalBegin()
        Method to begin the transaction.
      • preFlush

        public void preFlush()
        Method to notify of preFlush.
        Specified by:
        preFlush in interface Transaction
      • flush

        public void flush()
        Method to flush the transaction.
        Specified by:
        flush in interface Transaction
      • end

        public void end()
        Method to allow the transaction to flush any resources.
        Specified by:
        end in interface Transaction
      • commit

        public void commit()
        Method to commit the transaction.
        Specified by:
        commit in interface Transaction
      • internalPreCommit

        protected void internalPreCommit()
        Method to perform any pre-commit operations like flushing to the datastore, calling the users "beforeCompletion", and general preparation for the commit.
      • internalCommit

        protected void internalCommit()
        Internal commit, DataNucleus invokes it's own transaction manager implementation, if an external transaction manager is not used.
      • rollback

        public void rollback()
        Method to rollback the transaction.
        Specified by:
        rollback in interface Transaction
      • internalPreRollback

        protected void internalPreRollback()
      • internalRollback

        protected void internalRollback()
        Internal rollback. DataNucleus invokes it's own transaction manager implementation, if an external transaction manager is not used.
      • internalPostCommit

        protected void internalPostCommit()
        Method to perform any post-commit operations like calling the users "afterCompletion" and general clean up after the commit.
      • isActive

        public boolean isActive()
        Accessor for whether the transaction is active.
        Specified by:
        isActive in interface Transaction
        Returns:
        Whether the transaction is active.
      • getIsActive

        public boolean getIsActive()
        Similar to "isActive" except that it just returns the "active" flag whereas the isActive() method can also embody rejoining to underlying transactions.
        Specified by:
        getIsActive in interface Transaction
        Returns:
        The "active" flag
      • isCommitting

        public boolean isCommitting()
        Accessor for whether the transaction is comitting.
        Specified by:
        isCommitting in interface Transaction
        Returns:
        Whether the transaction is committing.
      • getNontransactionalRead

        public boolean getNontransactionalRead()
        Accessor for the nontransactionalRead flag for this transaction.
        Specified by:
        getNontransactionalRead in interface Transaction
        Returns:
        Whether nontransactionalRead is set.
      • getNontransactionalWrite

        public boolean getNontransactionalWrite()
        Accessor for the nontransactionalWrite flag for this transaction.
        Specified by:
        getNontransactionalWrite in interface Transaction
        Returns:
        Whether nontransactionalWrite is set.
      • getNontransactionalWriteAutoCommit

        public boolean getNontransactionalWriteAutoCommit()
        Accessor for whether non-tx writes are auto-commit.
        Specified by:
        getNontransactionalWriteAutoCommit in interface Transaction
        Returns:
        Whether auto-committing non-tx writes.
      • getOptimistic

        public boolean getOptimistic()
        Accessor for the Optimistic setting
        Specified by:
        getOptimistic in interface Transaction
        Returns:
        Whether optimistic transactions are in operation.
      • getRestoreValues

        public boolean getRestoreValues()
        Accessor for the restoreValues flag for this transaction.
        Specified by:
        getRestoreValues in interface Transaction
        Returns:
        Whether restoreValues is set.
      • getRetainValues

        public boolean getRetainValues()
        Accessor for the retainValues flag for this transaction.
        Specified by:
        getRetainValues in interface Transaction
        Returns:
        Whether retainValues is set.
      • getRollbackOnly

        public boolean getRollbackOnly()
        Accessor for the "rollback only" flag.
        Specified by:
        getRollbackOnly in interface Transaction
        Returns:
        The rollback only flag
      • getSynchronization

        public javax.transaction.Synchronization getSynchronization()
        Accessor for the synchronization object to be notified on transaction completion.
        Specified by:
        getSynchronization in interface Transaction
        Returns:
        The synchronization instance to be notified on transaction completion.
      • setNontransactionalRead

        public void setNontransactionalRead​(boolean nontransactionalRead)
        Mutator for the setting of nontransactional read.
        Specified by:
        setNontransactionalRead in interface Transaction
        Parameters:
        nontransactionalRead - Whether to allow nontransactional read operations
      • setNontransactionalWrite

        public void setNontransactionalWrite​(boolean nontransactionalWrite)
        Mutator for the setting of nontransactional write.
        Specified by:
        setNontransactionalWrite in interface Transaction
        Parameters:
        nontransactionalWrite - Whether to allow nontransactional write operations
      • setNontransactionalWriteAutoCommit

        public void setNontransactionalWriteAutoCommit​(boolean autoCommit)
        Mutator for whether non-tx writes are auto-commit (false implies delayed til next transaction commit).
        Specified by:
        setNontransactionalWriteAutoCommit in interface Transaction
        Parameters:
        autoCommit - Whether auto-commit of non-tx writes
      • setOptimistic

        public void setOptimistic​(boolean optimistic)
        Mutator for the optimistic transaction setting.
        Specified by:
        setOptimistic in interface Transaction
        Parameters:
        optimistic - The optimistic transaction setting.
      • setRestoreValues

        public void setRestoreValues​(boolean restoreValues)
        Mutator for the setting of restore values.
        Specified by:
        setRestoreValues in interface Transaction
        Parameters:
        restoreValues - Whether to restore values at commit
      • setRetainValues

        public void setRetainValues​(boolean retainValues)
        Mutator for the setting of retain values.
        Specified by:
        setRetainValues in interface Transaction
        Parameters:
        retainValues - Whether to retain values at commit
      • setRollbackOnly

        public void setRollbackOnly()
        Mutator for the "rollback only" flag. Sets the transaction as for rollback only.
        Specified by:
        setRollbackOnly in interface Transaction
      • setSavepoint

        public void setSavepoint​(String name)
        Description copied from interface: Transaction
        Method to register the current position as a savepoint with the provided name (assuming the datastore supports it).
        Specified by:
        setSavepoint in interface Transaction
        Parameters:
        name - Savepoint name
      • releaseSavepoint

        public void releaseSavepoint​(String name)
        Description copied from interface: Transaction
        Method to deregister the current position as a savepoint with the provided name (assuming the datastore supports it).
        Specified by:
        releaseSavepoint in interface Transaction
        Parameters:
        name - Savepoint name
      • rollbackToSavepoint

        public void rollbackToSavepoint​(String name)
        Description copied from interface: Transaction
        Method to rollback the transaction to the specified savepoint (assuming the datastore supports it).
        Specified by:
        rollbackToSavepoint in interface Transaction
        Parameters:
        name - Savepoint name
      • setSynchronization

        public void setSynchronization​(javax.transaction.Synchronization sync)
        Mutator for the synchronization object to be notified on transaction completion.
        Specified by:
        setSynchronization in interface Transaction
        Parameters:
        sync - The synchronization object to be notified on transaction completion
      • getSerializeRead

        public Boolean getSerializeRead()
        Description copied from interface: Transaction
        Accessor for the setting for whether to serialize read objects (lock them).
        Specified by:
        getSerializeRead in interface Transaction
        Returns:
        the value of the serializeRead property
      • setSerializeRead

        public void setSerializeRead​(Boolean serializeRead)
        Description copied from interface: Transaction
        Mutator for whether to serialize (lock) any read objects in this transaction.
        Specified by:
        setSerializeRead in interface Transaction
        Parameters:
        serializeRead - Whether to serialise (lock) any read objects
      • setProperties

        public void setProperties​(PropertyStore properties)