Called by JDBCTransactionManager.
519807
Connection getConnectionForTxn(IsolationLevel level) throws FetchException {
        try {
            if (mOpenConnections == null) {
                throw new FetchException("Repository is closed");
            }

            // Get connection outside lock section since it may block.
            Connection con = mDataSource.getConnection();

            if (level == IsolationLevel.NONE) {
                con.setAutoCommit(true);
            } else {
                con.setAutoCommit(false);
                if (level != mDefaultIsolationLevel) {
                    con.setTransactionIsolation(mapIsolationLevelToJdbc(level));
                }
            }

            mOpenConnectionsLock.lock();
            try {
                if (mOpenConnections == null) {
                    con.close();
                    throw new FetchException("Repository is closed");
                }
                mOpenConnections.put(con, null);
            } finally {
                mOpenConnectionsLock.unlock();
            }

            return con;
        } catch (Exception e) {
            throw toFetchException(e);
        }
    }
1041695
public void registerTransaction(TransactionImpl tran) {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "registerTransaction", new Object[] { this, tran });

        _recoveringTransactions.add(tran);

        if (tc.isEntryEnabled())
            Tr.exit(tc, "registerTransaction", _recoveringTransactions.size());
    }
368473
void rollback(long fromTransactionId) {
        long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "rollback", fromTransactionId);
        List<Long> rolledBack = new ArrayList<>();
        while (!this.transactions.isEmpty() && this.transactions.peekLast().getTransactionId() >= fromTransactionId) {
            ContainerMetadataUpdateTransaction txn = this.transactions.removeLast();
            txn.seal();
            rolledBack.add(txn.getTransactionId());
        }

        // At this point, the transaction list is either empty or its last one is sealed; any further changes would
        // require creating a new transaction.
        LoggerHelpers.traceLeave(log, this.traceObjectId, "rollback", traceId, rolledBack);
    }
1367035
protected function rollbackTransaction()
    {
        $this->entityManager->rollback();

        $connection = $this->entityManager->getConnection();
        if (!$connection->isTransactionActive() || $connection->isRollbackOnly()) {
            $this->entityManager->close();
        }
    }
10738
private void commitTransaction() {
        Tenant tenant = Tenant.getTenant(m_tableDef);
        DBTransaction dbTran = DBService.instance(tenant).startTransaction();
        m_parentTran.applyUpdates(dbTran);
        DBService.instance(tenant).commit(dbTran);
        m_parentTran.clear();
    }
1153776
public final function transactionCommit()
    {
        if (1 == $this->intTransactionDepth) {
            $this->executeTransactionCommit();
        }
        if ($this->intTransactionDepth <= 0) {
            throw new Caller("The transaction commit call is called before the transaction begin was called.");
        }
        $this->intTransactionDepth--;
    }
311615
public void commit(DBTransaction dbTran) {
        // For extreme logging
        if (m_logger.isTraceEnabled()) {
            dbTran.traceMutations(m_logger);
        }
        try {
            long timestamp = Utils.getTimeMicros();
            commitMutations(dbTran, timestamp);
            commitDeletes(dbTran, timestamp);
        } finally {
            dbTran.clear();
        }
    }
180691
protected void prepareTransactionMemoriesIfExists() {
        final SavedTransactionMemories memories = ThreadCacheContext.findTransactionMemories();
        if (memories != null) {
            final List<TransactionMemoriesProvider> providerList = memories.getOrderedProviderList();
            final StringBuilder sb = new StringBuilder();
            for (TransactionMemoriesProvider provider : providerList) {
                provider.provide().ifPresent(result -> sb.append("\n*").append(result));
            }
            final WholeShowAttribute attribute = new WholeShowAttribute(sb.toString().trim());
            requestManager.setAttribute(LastaWebKey.DBFLUTE_TRANSACTION_MEMORIES_KEY, attribute);
        }
    }
773958
private void executeOperation(DbUnitDatabasePopulator populator, DataSource dataSource) throws Exception {

        Connection connection = null;

        try {
            connection = getConnection(dataSource);
            populator.populate(connection);

        } finally {
            if (connection != null && !isConnectionTransactional(connection, dataSource)) {
                // if the connection is transactional, closing it. Otherwise,
                // expects that the framework will do it
                releaseConnection(connection, dataSource);
            }
        }
    }
855752
public void commitTransaction()
   {
      CompressedISPNChangesBuffer changesContainer = getChangesBufferSafe();
      final TransactionManager tm = getTransactionManager();
      try
      {
         final List<ChangesContainer> containers = changesContainer.getSortedList();
         commitChanges(tm, containers);
      }
      finally
      {
         changesList.set(null);
         changesContainer = null;
      }
   }
430973
protected void suspendTransaction() {
        //create local variable - JIT performance improvement
        final boolean isTraceOn = com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[SUSPEND_TRANSACTION]);
        }
        Object[] suspendedTx = { null, null }; // PM56632
        //        UOWCurrent uowCurrent = TransactionManagerFactory.getUOWCurrent();
        UOWCurrent uowCurrent = this.getDatabaseStoreService().getUOWCurrent();
        UOWCoordinator uowCoord = uowCurrent.getUOWCoord();
        //        LocalTransactionCurrent ltCurrent = TransactionManagerFactory.getLocalTransactionCurrent(); //d120870.2
        LocalTransactionCurrent ltCurrent = this.getDatabaseStoreService().getLocalTransactionCurrent();

        if (uowCoord == null) {
            // There is no Global or Local Transaction
            // We must start a LocalTransaction
            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUSPEND_TRANSACTION], "No Global or Local Transaction exists");
            }
        } else if (!uowCoord.isGlobal()) {
            // There is a LocalTransaction, it must be suspended
            // and a new LocalTransaction begun
            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUSPEND_TRANSACTION], "LocalTransaction is active so suspend");
            }
            // Suspend the LocalTransaction and return the LocalTransactionCoordinator as an Object
            suspendedTx[0] = (Object) ltCurrent.suspend();

        } else {
            // else we have a global transaction
            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUSPEND_TRANSACTION], "Global Transaction is Active");
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUSPEND_TRANSACTION], "Global Transaction is Active so suspend");
            }
            try {
                //                suspendedTx = TransactionManagerFactory.getTransactionManager().suspend();
                suspendedTx[0] = this.getDatabaseStoreService().getEmbeddableWebSphereTransactionManager().suspend();
            } catch (Throwable th) {
                // Only required as JTA specifies exception, but implementation never throws one
            }
            // START: PM56632 need to check if there is a local transaction since global suspend does not suspend local transaction
            uowCoord = this.getDatabaseStoreService().getUOWCurrent().getUOWCoord();
            if (uowCoord != null && !uowCoord.isGlobal()) {
                if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUSPEND_TRANSACTION], "LocalTransaction is active after global suspend");
                }
                // Suspend the LocalTransaction and return the LocalTransactionCoordinator as an Object
                suspendedTx[1] = (Object) ltCurrent.suspend();
            }
            // END: PM56632
        }

        if (suspendedTx[0] != null || suspendedTx[1] != null)
            suspendedTransactions.put(Thread.currentThread(), suspendedTx);

        try {
            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[SUSPEND_TRANSACTION], "Starting a Local Transaction");
            }
            //            ltCurrent.begin();
            boolean boundaryIsAS = false; // true if the boundary is ActivitySession; false if the boundary is BeanMethod
            boolean unresActionIsCommit = false; // true if the unresolved action is commit; false if it is rollback
            boolean resolverIsCAB = false; // true if the resolver is ContainerAtBoundary; false if it is Application
            //          The following Starts a new LTC scope and associates it with the current thread.
            //          The configuration of the LTC is determined by the caller rather than via J2EE component metadata.
            //          Throws IllegalStateException if the LocalTransactionCoordinator is not in a
            //          valid state to execute the operation, for example if a global transaction is active.
            ltCurrent.begin(boundaryIsAS, unresActionIsCommit, resolverIsCAB);
        } catch (Exception ex) {
            // Absorb any exception to ensure we still exit cleanly and resume
            // any suspended LTC in postInvoke.
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[SUSPEND_TRANSACTION], "DatabaseHashMap.cantstartLTC");
        }

        if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
            LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[SUSPEND_TRANSACTION]);
        }
    }
909939
public synchronized void prepare(Transaction transaction)
                    throws ObjectManagerException
    {
        throw new InvalidStateException(this, InternalTransaction.stateTerminated, InternalTransaction.stateNames[InternalTransaction.stateTerminated]);
    }
1271573
public <T> T execute(Callable<T> statements) throws Exception
	{
		try (HibernateTransaction tx = start().withAutoRollback())
		{
			final T ret = statements.call();

			// Success, perform a TX commit
			tx.commit();

			return ret;
		}
	}
1362503
public void rollbackTransaction() throws MarkLogicTransactionException {
		if(isActiveTransaction()) {
			try {
				sync();
			} catch (MarkLogicSesameException e) {
				throw new MarkLogicTransactionException(e);
			}
			this.tx.rollback();
			this.tx = null;
		}else{
			throw new MarkLogicTransactionException("No active transaction to rollback.");
		}
	}
1292672
public function beginTransaction()
	{
		if( !$this->dbc )
			throw new RuntimeException( 'Database not conntected' );

		$this->openTransactions ++;
		if( $this->openTransactions == 1 )
		{
			if( self::$autoCommit )
				$this->execute( 'SET AUTOCOMMIT=0' );
			$this->execute( 'START TRANSACTION' );
		}
	}
543332
void localTransactionRolledBack(final SibRaConnection connection) {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "localTransactionRolledBack", connection);
        }

        final ConnectionEvent event = new ConnectionEvent(this,
                ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK);
        event.setConnectionHandle(connection);

        for (Iterator iterator = _eventListeners.iterator(); iterator.hasNext();) {

            final ConnectionEventListener listener = (ConnectionEventListener) iterator
                    .next();
            listener.localTransactionRolledback(event);

        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "localTransactionRolledBack");
        }

    }
80508
public void tx(VoidFunc1<Session> func) throws SQLException {
		try {
			beginTransaction();
			func.call(this);
			commit();
		} catch (Throwable e) {
			quietRollback();
			throw (e instanceof SQLException) ? (SQLException) e : new SQLException(e);
		}
	}