Should only be used with MDW data source
@param transaction
494541
public void stopTransaction(TransactionWrapper transaction) throws DataAccessException {
        if (logger.isTraceEnabled()) {
            logger.trace("stopTransaction");
        }
        if (transaction==null) {
            if (logger.isTraceEnabled())
                logger.trace("   ... transaction is null");
            return;
        }
        if (!transaction.isTransactionAlreadyStarted()) {
            DataAccessException exception = null;
            if (!transaction.isDatabaseConnectionAlreadyOpened()) {
                if (!(db.getConnection() instanceof XAConnection)) {
                    if (transaction.isRollbackOnly()) db.rollback();
                    else {
                        try {
                            db.commit();
                        } catch (SQLException e) {
                            exception = new DataAccessException(0, "Fail to commit", e);
                        }
                    }
                }
                db.closeConnection();
            } else {
                if (logger.isTraceEnabled())
                    logger.trace("   ... database opened by others");
            }
            try {
                TransactionUtil transUtil = TransactionUtil.getInstance();
                TransactionManager transManager = transUtil.getTransactionManager();
                if (transaction.isRollbackOnly()) transManager.rollback();
                else transManager.commit();
                transUtil.setCurrentConnection(null);
                //transUtil.clearCurrentConnection();
            } catch (Exception e) {
                throw new DataAccessException(0, "Fail to stop the transaction", e);
            }
            if (exception!=null) throw exception;
        } else {
            if (logger.isTraceEnabled())
                logger.trace("   ... transaction started by others");
        }
    }
384665
public final void commitPersistLock(PersistentTransaction transaction) throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "commitPersistLock", transaction);

        AbstractItem item = null;
        boolean hasBecomePersistentlyLocked = false;
        boolean linkHasBecomeReleasable = false;
        synchronized (this)
        {
            if (ItemLinkState.STATE_PERSISTING_LOCK == _itemLinkState)
            {
                _assertCorrectTransaction(transaction);
                item = _getAndAssertItem();
                final int strategy = _tuple.getStorageStrategy();
                if ((AbstractItem.STORE_NEVER != strategy) &&
                    (AbstractItem.STORE_MAYBE != strategy))
                { // 272110 - added STORE_MAYBE to ease handling of corrupt persistent representation
                  // storable items can be discarded if in persistentLocked state
                    linkHasBecomeReleasable = _declareDiscardable();
                }
                _itemLinkState = ItemLinkState.STATE_PERSISTENTLY_LOCKED;
                hasBecomePersistentlyLocked = true;
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    SibTr.event(this, tc, "Invalid Item state: " + _itemLinkState);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(this, tc, "commitPersistLock");
                throw new StateException(_itemLinkState.toString());
            }
            _transactionId = null;
        }
        if (hasBecomePersistentlyLocked)
        {
            if (linkHasBecomeReleasable)
            {
                _declareReleasable(item);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "commitPersistLock");
    }
140927
public <T> T manageTransaction( DatabaseContext ctx, TransactionManagedAction<T> action )
	{
		ctx.db.startTransaction();
		try
		{
			T result = action.execute( ctx );

			ctx.db.commit();

			return result;
		}
		catch( Exception exception )
		{
			ctx.db.rollback();

			throw new ManagedTransactionException( "Exception during managed transaction, see cause for details", exception );
		}
	}
939808
protected void handleRollback(LocalTransaction transaction)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "handleRollback", transaction);

    // Roll back the transaction if we created it.
    if (transaction != null)
    {
      try
      {
        transaction.rollback();
      }
      catch (SIException e)
      {
        // FFDC
        FFDCFilter.processException(
          e,
          "com.ibm.ws.sib.processor.impl.PtoPOutputHandler.handleRollback",
          "1:1644:1.241",
          this);

        SibTr.exception(tc, e);
      }
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "handleRollback");
  }
45445
public void commit(DBTransaction transaction) {
        try {
            applyUpdates(transaction);
        } catch (Exception e) {
            m_logger.error("Updates failed", e);
            throw e;
        } finally {
            transaction.clear();
        }
    }
131926
public final void commitInternal(final PersistentTransaction transaction)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "commitInternal", transaction);

        getLink().internalCommitAdd();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "commitInternal");
    }
1240011
public void doBegin(Object transaction, TransactionDefinition definition) throws TransactionException {
		try {
			CompensatingTransactionObject txObject = (CompensatingTransactionObject) transaction;
			if (txObject.getHolder() == null) {
				CompensatingTransactionHolderSupport contextHolder = getNewHolder();
				txObject.setHolder(contextHolder);

				TransactionSynchronizationManager.bindResource(getTransactionSynchronizationKey(), contextHolder);
			}
		}
		catch (Exception e) {
			throw new CannotCreateTransactionException("Could not create DirContext instance for transaction", e);
		}
	}
1184400
protected void checkTransactionSupported(Connection conn) throws SQLException, DbRuntimeException {
		if (null == isSupportTransaction) {
			isSupportTransaction = conn.getMetaData().supportsTransactions();
		}
		if (false == isSupportTransaction) {
			throw new DbRuntimeException("Transaction not supported for current database!");
		}
	}
581559
public final void abortAdd(final PersistentTransaction transaction) throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "abortAdd", transaction);

        long _referredID = getTuple().getReferredID();
        super.abortAdd(transaction);
        if (AbstractItem.NO_ID != _referredID)
        {
            MessageStoreImpl msi = getMessageStoreImpl();
            ItemLink itemLink = (ItemLink) msi.getMembership(_referredID);
            if (null != itemLink)
            {
                itemLink.rollbackIncrementReferenceCount(transaction);
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                {
                    SibTr.debug(this, tc, "reference to non-existent item: " + _referredID);
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "abortAdd");
    }
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);
        }
    }
1186821
public void setTransactionType(final TransactionType transactionType) {
        if (null == schemaName) {
            throw new ShardingException("Please select database, then switch transaction type.");
        }
        if (isSwitchFailed()) {
            throw new ShardingException("Failed to switch transaction type, please terminate current transaction.");
        }
        this.transactionType = transactionType;
    }
948126
public static void commitTransaction() {
        Connection connection = tl_conn.get();
        if (connection == null) {
            throw new RuntimeException("You do not start a Transaction so you can not commit a transaction!");
        }
        try {
            connection.commit();
            connection.close();
            tl_conn.remove();
            tl_sp.remove();
        } catch (SQLException e) {
            JDBCUtils.rollbackTransaction();
            throw new RuntimeException(e);
        }
    }
816314
public void addOngoingTransaction(Transaction transaction) {

		if(transaction != null && ongoingTransactions != null  && !isReadyToInvalidate() ) {
			boolean added = this.ongoingTransactions.add(transaction);
			if(added) {
				if(logger.isDebugEnabled()) {
					logger.debug("transaction "+ transaction +" has been added to sip session's ongoingTransactions" );
				}
				setReadyToInvalidate(false);
			}
		}
	}
1099072
public void update( Transaction transaction ) {
    RestfulUtils.update( TransactionService.PATH, transaction, Transaction.class, super.httpClient );
  }
1231829
public static void addTxn(TransactionImpl txn)
    {
        if (tc.isEntryEnabled()) Tr.entry(tc, "addTxn", txn);

        final ByteArray key = new ByteArray(txn.getXid().getGlobalTransactionId());

        synchronized (txnTable)
        {
            if (!txnTable.containsKey(key))
            {
                txnTable.put(key, new JCATranWrapperImpl(txn, true, false)); // @LIDB2110C
            }
        }

        if (tc.isEntryEnabled()) Tr.exit(tc, "addTxn");
    }
421086
private void removeStateItemStreams(Transaction transaction)
    throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "removeStateItemStreams", transaction );

    try
    {
      // Clean up mqlink state stream. This is a raw itemstream so
      // we do this "by hand". 
      if( _mqLinkStateItemStream != null && _mqLinkStateItemStream.isInStore()) 
      {
        Item item = null;
    
        while (null != (item = _mqLinkStateItemStream.findFirstMatchingItem(null)))
        {
          item.remove(transaction, NO_LOCK_ID);
        }
        
        // Now remove the itemstream itself
        _mqLinkStateItemStream.remove(transaction, NO_LOCK_ID);        
      }
      
      // Clean up pubsub bridge state itemstream.
      // Note that pubsub bridge should already have tidied up contained
      // itemstreams. This does a final tidy and removes the state itemstream
      // itself.  Must check that this is not in store as we may have the item stream
      // from a previous failed delete
      if( _mqLinkPubSubBridgeItemStream != null && _mqLinkPubSubBridgeItemStream.isInStore()) 
      {
        _mqLinkPubSubBridgeItemStream.removeAll(transaction);
      }
      
      // Set refs to null removed as we may fail the delete later.
//      _mqLinkStateItemStream = null;
//      _mqLinkPubSubBridgeItemStream = null;  
    }
    catch (MessageStoreException e)
    {
      // FFDC
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.MQLinkHandler.removeStateItemStreams",
        "1:910:1.71",
        this);

      SibTr.exception(tc, e);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "removeStateItemStreams", e);

      throw new SIResourceException(e);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "removeStateItemStreams");
  }
830760
void postCommit(Transaction transaction)
                    throws ObjectManagerException
    {
        throw new InvalidStateException(this, InternalTransaction.stateTerminated, InternalTransaction.stateNames[InternalTransaction.stateTerminated]);
    }