mark the transaction as preparing, blocking the commit and rollback commands until the {@link #prepared()} is
invoked
170783
public synchronized void preparing() {
      if (trace) {
         log.tracef("[%s] Current status is %s, setting status to: PREPARING", globalTransaction.globalId(),
                    transactionState);
      }
      transactionState.add(State.PREPARING);
   }
319787
@Override
    public void commit() throws InvalidKBException {
        if (isClosed()) {
            return;
        }
        try {
            checkMutationAllowed();
            removeInferredConcepts();
            validateGraph();
            // lock on the keyspace cache shared between concurrent tx's to the same keyspace
            // force serialization & atomic updates, keeping Janus and our KeyspaceCache in sync
            synchronized (keyspaceCache) {
                commitTransactionInternal();
                transactionCache.flushToKeyspaceCache();
            }
        } finally {
            String closeMessage = ErrorMessage.TX_CLOSED_ON_ACTION.getMessage("committed", keyspace());
            closeTransaction(closeMessage);
        }
    }
523675
@Override
    public Vote prepare(String globalId) throws SystemException, HeuristicHazardException, HeuristicMixedException, RollbackException {

        final TransactionWrapper t = TransactionWrapper.getTransactionWrapper(globalId);

        if (t != null) {
            return t.prepare();
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "No matching TransactionWrapper: " + globalId);
            throw new SystemException();
        }
    }
702862
@Override
    public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
            SecurityException, IllegalStateException, SystemException
    {
        if (!setRollBackOnly)
        {
            for (ResourceManager implementor : implementors)
            {
                if (implementor != null)
                {
                    implementor.doCommit();
                }
            }
            status = Status.STATUS_COMMITTED;
        }
        else
        {
            if (log.isDebugEnabled())
                log.debug("Transaction is set for rollback only, processing rollback.");

            for (ResourceManager implementor : implementors)
            {
                if (implementor != null)
                {
                    implementor.doRollback();
                    status = Status.STATUS_ROLLEDBACK;
                }
            }
        }

    }
419614
def rollback(self):
        
        self._check_thread()
        if self.state not in (_STATE_ACTIVE, _STATE_PARTIAL_COMMIT):
            raise TransactionError("Transaction is not active.")
        try:
            if self.state != _STATE_PARTIAL_COMMIT:
                request = transaction_rollback_codec.encode_request(self.id, self.thread_id)
                self.client.invoker.invoke_on_connection(request, self.connection).result()
            self.state = _STATE_ROLLED_BACK
        finally:
            self._locals.transaction_exists = False
458267
def commit(self):
        """"""
        self.flush()
        if hasattr(self, 'transaction') and self.transaction.is_active:
            self.transaction.commit()
        elif hasattr(self, 'connection'):
            self.connection.commit()
296050
protected void modify(Transaction t) {
        try {
            this.lock.writeLock().lock();
            t.perform();
        } finally {
            this.lock.writeLock().unlock();
        }
    }
1295032
public final T execute()
   {
      boolean txOwner = !TransactionElf.hasTransactionManager() || TransactionElf.beginOrJoinTransaction();
      Connection connection = null;
      try {
         connection = ConnectionProxy.wrapConnection(dataSource.getConnection());
         if (txOwner) {
            // disable autoCommit mode as we are going to handle transaction by ourselves
            connection.setAutoCommit(false);
         }
         return (args == null)
            ? execute(connection)
            : execute(connection, args);
      }
      catch (SQLException e) {
         if (e.getNextException() != null) {
            e = e.getNextException();
         }
         if (txOwner) {
            // set the txOwner to false as we no longer own the transaction and we shouldn't try to commit it later
            txOwner = false;
            rollback(connection);
         }
         throw new RuntimeException(e);
      } catch (Throwable e) {
         if (txOwner) {
            txOwner = false;
            rollback(connection);
         }
         throw e;
      }
      finally {
         try {
            if (txOwner) {
               commit(connection);
            }
         }
         finally {
            quietClose(connection);
         }
      }
   }
843374
void prepareTransaction(HotRodHeader header, Subject subject, XidImpl xid, boolean onePhaseCommit,
         List<TransactionWrite> writes, boolean recoverable, long timeout) {
      HotRodServer.CacheInfo cacheInfo = server.getCacheInfo(header);
      AdvancedCache<byte[], byte[]> cache = server.cache(cacheInfo, header, subject);
      validateConfiguration(cache);
      executor.execute(() -> prepareTransactionInternal(header, cache, cacheInfo.versionGenerator, xid, onePhaseCommit,
                                                        writes, recoverable, timeout));
   }
778290
public function commit() {
		if ($this->transactionManager === null) {
			$this->prepareCommit();
			$this->performCommit();
		}
		
		if ($this->transactionManager->hasOpenTransaction()) {
			$this->transactionManager->getRootTransaction()->commit();
		}
	}
711320
public function commit()
	{
		if ( $this->transactionCount < 1 ) {
			return;
		}
		$transaction = $this->unprepared( "COMMIT;" );
		if ( false !== $transaction ) {
			$this->transactionCount --;
		}
	}
219879
public void commitTransaction ()
    {
        if (_tevent == null) {
            String errmsg = "Cannot commit: not involved in a transaction [dobj=" + this + "]";
            throw new IllegalStateException(errmsg);
        }

        // if we are nested, we decrement our nesting count rather than committing the transaction
        if (_tcount > 0) {
            _tcount--;

        } else {
            // we may actually be doing our final commit after someone already cancelled this
            // transaction, so we need to perform the appropriate action at this point
            if (_tcancelled) {
                _tevent.cancel();
            } else {
                _tevent.commit();
            }
        }
    }
1173589
@Override
    public final int prepare() throws XAException
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "prepare", new Object[] { _resource, _xid });
        if (tcSummary.isDebugEnabled())
            Tr.debug(tcSummary, "xa_prepare", this);

        int rc = -1;

        try
        {
            try
            {
                // Ensure that the associated XARecoveryData (the PartnerLogData entry in the PartnerLogTable)
                // has logged itself to the partner log. If the PLD was created before the recovery log
                // was available we need to ensure that it writes itself to the parter log now. Additionally,
                // if this was the case, the recovery id it holds is updated from zero to the real value 
                // so we need to update the value cached in this object (originally obtained during contruction
                // from the pre-logged PLD).  If we logged at enlist time, this is a no-op.
                _recoveryData.logRecoveryEntry();
            } catch (Exception e)
            {
                throw new XAException(XAException.XAER_INVAL);
            }

            rc = _resource.prepare(_xid);

            //
            // Convert to Vote.
            //
            if (rc == XAResource.XA_OK)
            {
                // Record the Vote
                _vote = JTAResourceVote.commit;
                return rc;
            }
            else if (rc == XAResource.XA_RDONLY)
            {
                // Record the Vote
                _vote = JTAResourceVote.readonly;
                destroy();
                return rc;
            }
        } catch (XAException xae)
        {
            _prepareXARC = xae.errorCode;
            // Record the prepare XA return code
            FFDCFilter.processException(xae, "com.ibm.ws.Transaction.JTA.JTAXAResourceImpl.prepare", "259", this);

            if (_prepareXARC >= XAException.XA_RBBASE && _prepareXARC <= XAException.XA_RBEND)
            {
                _vote = JTAResourceVote.rollback;
            }
            else if (_prepareXARC == XAException.XAER_RMFAIL)
            {
                // Force reconnect on rollback
                _state = FAILED;
            }

            throw xae;
        } finally
        {
            if (tc.isEntryEnabled())
            {
                if (_vote != null)
                {
                    Tr.exit(tc, "prepare", XAReturnCodeHelper.convertXACode(rc) + " (" + _vote.name() + ")");
                }
                else
                {
                    Tr.exit(tc, "prepare", XAReturnCodeHelper.convertXACode(rc));
                }
            }

            if (tcSummary.isDebugEnabled())
                Tr.debug(tcSummary, "xa_prepare result: " +
                                    XAReturnCodeHelper.convertXACode(rc));
        }

        // Any other response is invalid
        throw new XAException(XAException.XAER_INVAL);
    }
847885
private void applyUpdates(DBTransaction transaction) {
        if (transaction.getMutationsCount() == 0) {
            m_logger.debug("Skipping commit with no updates");
        } else if (m_dbservice.getParamBoolean("async_updates")) {
            executeUpdatesAsynchronous(transaction);
        } else {
            executeUpdatesSynchronous(transaction);
        }
    }
1334652
@Override
	public void commit() {
		Optional<LocalTransactionContext> txContext = currentTxContext();
		if (txContext.isPresent()) {
			txContext.get().commit();
		} else {
			this.unmanagedTransaction.ifPresent(LocalTransactionContext::commit);
		}
	}
1094857
async def prepare(self):
        

        if not self._parent.is_active:
            raise exc.InvalidRequestError("This transaction is inactive")
        await self._connection._prepare_twophase_impl(self._xid)
        self._is_prepared = True
1060756
public void localCommit()
    {
        if (log.isDebugEnabled()) log.debug("commit was called");
        if (!this.isInLocalTransaction)
        {
            throw new TransactionNotInProgressException("Not in transaction, call begin() before commit()");
        }
        try
        {
            if(!broker.isManaged())
            {
                if (batchCon != null)
                {
                    batchCon.commit();
                }
                else if (con != null)
                {
                    con.commit();
                }
            }
            else
            {
                if(log.isDebugEnabled()) log.debug(
                        "Found managed environment setting in PB, will skip Connection.commit() call");
            }
        }
        catch (SQLException e)
        {
            log.error("Commit on underlying connection failed, try to rollback connection", e);
            this.localRollback();
            throw new TransactionAbortedException("Commit on connection failed", e);
        }
        finally
        {
            this.isInLocalTransaction = false;
            restoreAutoCommitState();
            this.releaseConnection();
        }
    }