Begin a new local transaction by readying this object for re-use by the
ItemStream interfaces.

@exception SIIncorrectCallException
Thrown if existing work has not been completed.
191259
public void begin() throws SIIncorrectCallException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "begin");

        // Are we currently in use? do we have work
        // we still need to commit?
        if (_state == TransactionState.STATE_ACTIVE && _workList != null)
        {
          SIIncorrectCallException ice = new SIIncorrectCallException(nls.getFormattedMessage("TRAN_PROTOCOL_ERROR_SIMS1001", null, "TRAN_PROTOCOL_ERROR_SIMS1001"));
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Cannot begin new LocalTran. Existing work needs completing first!", ice);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "begin");
            throw ice;
        }

        synchronized(this)
        {
          _ptid     = null;
        }
        _workList = null;
        _size     = 0;

        _callbacks.clear();

        _state = TransactionState.STATE_ACTIVE;


        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "begin");
    }
425981
public function transactionStart()
    {
        if (empty($this->oDb)) {
            $this->connect();
        }

        try {

            $this->oDb->beginTransaction();
            $this->transactionRunning = true;

            return true;

        } catch (\Exception $e) {
            throw new TransactionException($e->getMessage(), $e->getCode());
        }
    }
1226255
public void beginTransaction() throws SQLException {
		final Connection conn = getConnection();
		checkTransactionSupported(conn);
		conn.setAutoCommit(false);
	}
1168531
void startTransactionalBranch(Xid xid) {

        cleanupTransactionBinding();

        final TransactionBindingType transactionBindingType = this.transactionBinding.getTransactionBindingType();

        // already associated to a local transaction
        if (transactionBindingType == TransactionBindingType.LocalTransaction) {
            LocalTransactionProxy<C> localTransactionProxy = this.toLocalTransaction();
            Validate.isTrue(!localTransactionProxy.hasTransactionalData(),
                    "Connection is associated to a local transaction and has uncommitted transactional data");
            if (localTransactionProxy.hasTransactionalData()) {
                throw new IllegalStateException(
                        "Connection is associated to a local transaction and has uncommitted transactional data");
            }

            XATransactionalBranch<C> xaTransactionalBranch = 
                    this.xaTransactionalBranchDictionary.findTransactionalBranch(xid);
            // xaTransactionalBranch!=null => joining a existing transactional branch
            if (xaTransactionalBranch == null) {
                IPhynixxManagedConnection<C> connection = localTransactionProxy.getConnection();
                if( connection==null || connection.isClosed()) {
                    connection= this.createPhysicalConnection();
                }
                xaTransactionalBranch = this.xaTransactionalBranchDictionary.instanciateTransactionalBranch(xid, connection);
            } else {
                localTransactionProxy.close();
            }
            // forget the Local transaction
            this.transactionBinding.release();

            XATransactionalBranch<C> transactionalBranch = this.xaTransactionalBranchDictionary
                    .findTransactionalBranch(xid);
            Validate.isTrue(xaTransactionalBranch != null, "Expect a transactional branch to be created");

            this.transactionBinding.activateGlobalTransaction(new GlobalTransactionProxy<C>(transactionalBranch));

            // no transaction binding
        } else if (transactionBindingType == TransactionBindingType.NoTransaction) {
            XATransactionalBranch<C> transactionalBranch = this.xaTransactionalBranchDictionary
                    .findTransactionalBranch(xid);

            // / xaTransactionalBranch!=null => joining a existing transactional
            // branch
            if (transactionalBranch == null) {
                IPhynixxManagedConnection<C> physicalConnection = this.createPhysicalConnection();
                transactionalBranch = this.xaTransactionalBranchDictionary.instanciateTransactionalBranch(xid,
                        physicalConnection);
                this.xaTransactionalBranchDictionary.instanciateTransactionalBranch(xid, physicalConnection);
            }
            this.transactionBinding.activateGlobalTransaction(new GlobalTransactionProxy<C>(transactionalBranch));

            // if bound to a global TX , check if same XID
        } else if (transactionBindingType == TransactionBindingType.GlobalTransaction) {

            XATransactionalBranch<C> transactionalBranch = this.xaTransactionalBranchDictionary
                    .findTransactionalBranch(xid);

            // xaTransactionalBranch!=null => joining a existing transactional
            // branch
            if (transactionalBranch == null) {
                IPhynixxManagedConnection<C> physicalConnection = this.createPhysicalConnection();
                transactionalBranch = this.xaTransactionalBranchDictionary.instanciateTransactionalBranch(xid,
                        physicalConnection);
                this.xaTransactionalBranchDictionary.instanciateTransactionalBranch(xid, physicalConnection);
            }

            // Check if previous XID are compatible to the current
            GlobalTransactionProxy<C> previousGlobalTransactionProxy = this.transactionBinding
                    .getEnlistedGlobalTransaction();
            if (previousGlobalTransactionProxy != null) {
                Xid previousXid = previousGlobalTransactionProxy.getXid();
                byte[] currentTransactionId = previousXid.getGlobalTransactionId();
                if (!Arrays.equals(xid.getGlobalTransactionId(), currentTransactionId)) {
                    LOG.warn("TransactionId of the new Transaction doenn't corresponds to the transactionId of the previous Ids");
                }
                previousGlobalTransactionProxy.release();
            }

            this.transactionBinding.activateGlobalTransaction(new GlobalTransactionProxy<C>(transactionalBranch));

        }

    }
1104270
final LocalTransactionCoordinator beginLocalTx()
    {
        LocalTransactionCoordinator lCoord = null;

        try {
            ltcCurrent.begin();
            lCoord = getLocalCoord(); // d175585
            if (TraceComponent.isAnyTracingEnabled()) // d527372
            {
                if (tc.isEventEnabled())
                {
                    if (lCoord != null) {
                        Tr.event(tc, "Began LTC cntxt: tid=" +
                                     Integer.toHexString(lCoord.hashCode()) + "(LTC)");
                    } else {
                        Tr.event(tc, "Began LTC cntxt: " + "null Coordinator!");
                    }
                }
                // d165585 Begins
                if (lCoord != null && TETxLifeCycleInfo.isTraceEnabled()) // d171555
                {
                    TETxLifeCycleInfo.traceLocalTxBegin("" + System.identityHashCode(lCoord), "Begin Local Tx");
                }
                // d165585 Ends
            }
        } catch (Exception ex) {
            FFDCFilter.processException(ex, CLASS_NAME + ".beginLocalTx", "737", this);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Begin local tx failed", ex);
            }

        }
        return (lCoord);

    }
1349554
public function beginTransaction()
    {
        try {
            $this->connection->beginTransaction();
        } catch (DBALException $e) {
            throw new OrmException("Unable to start transaction.\n" . $e->getMessage(), 0, $e);
        }
    }
68540
public PtoPMessageItemStream addNewRemotePtoPLocalization(
    TransactionCommon transaction,
    SIBUuid8 messagingEngineUuid,
    LocalizationDefinition destinationLocalizationDefinition,
    boolean queuePoint,
    AbstractRemoteSupport remoteSupport) throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "addNewRemotePtoPLocalization",
        new Object[] {
          transaction,
          messagingEngineUuid,
          destinationLocalizationDefinition,
          Boolean.valueOf(queuePoint),
          remoteSupport });

    PtoPMessageItemStream newMsgItemStream = null;

    // Add to the MessageStore
    try
    {

        if (queuePoint)
        {
          newMsgItemStream =
            new PtoPXmitMsgsItemStream(_baseDestinationHandler, messagingEngineUuid);
        }

      transaction.registerCallback(
        new LocalizationAddTransactionCallback(newMsgItemStream));

      Transaction msTran = _messageProcessor.resolveAndEnlistMsgStoreTransaction(transaction);
      _baseDestinationHandler.addItemStream(newMsgItemStream, msTran);

      // Set the default limits
      newMsgItemStream.setDefaultDestLimits();
      // Setup any message depth interval checking (510343)
      newMsgItemStream.setDestMsgInterval();

      attachRemotePtoPLocalisation(newMsgItemStream, remoteSupport);
    }
    catch (OutOfCacheSpace e)
    {
      // No FFDC code needed

      SibTr.exception(tc, e);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "addNewRemotePtoPLocalization", "SIResourceException");

      throw new SIResourceException(e);
    }
    catch (MessageStoreException e)
    {
      // MessageStoreException shouldn't occur so FFDC.
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.destination.LocalisationManager.addNewRemotePtoPLocalization",
        "1:1562:1.30",
        this);

      SibTr.exception(tc, e);

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

      throw new SIResourceException(e);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "addNewRemotePtoPLocalization", newMsgItemStream);

    return newMsgItemStream;
  }
651831
protected synchronized void doWriteObjects(boolean isFlush) throws TransactionAbortedException, LockNotGrantedException
    {
        /*
        arminw:
        if broker isn't in PB-tx, start tx
        */
        if (!getBroker().isInTransaction())
        {
            if (log.isDebugEnabled()) log.debug("call beginTransaction() on PB instance");
            broker.beginTransaction();
        }

        // Notify objects of impending commits.
        performTransactionAwareBeforeCommit();

        // Now perfom the real work
        objectEnvelopeTable.writeObjects(isFlush);
        // now we have to perform the named objects
        namedRootsMap.performDeletion();
        namedRootsMap.performInsert();
        namedRootsMap.afterWriteCleanup();
    }
612495
public function begin()
    {
        $this->current = $this->current instanceof Transaction
            ? $this->current->newTransaction()
            : new Transaction;
    }
1024664
public void processLocalTransactionCommittedEvent(Object handle) throws ResourceException {
        // A application level local transaction has been committed.

        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        if (isTraceOn) 
        {
            if (tc.isEntryEnabled()) 
                Tr.entry(this, tc, "processLocalTransactionCommittedEvent", handle);

            if (tc.isDebugEnabled()) 
            { 
                String cId = null;
                try {
                    cId = mcf.getCorrelator(this); 
                } catch (SQLException x) {
                    // will just log the exception here and ignore it since its in trace
                    Tr.debug(this, tc, "got an exception trying to get the correlator in commit, exception is: ", x);
                }

                if (cId != null) {
                    StringBuffer stbuf = new StringBuffer(200);
                    stbuf.append("Correlator: DB2, ID: ");
                    stbuf.append(cId);
                    if (xares != null) {
                        stbuf.append(" Transaction : ");
                        stbuf.append(xares);
                    }
                    stbuf.append(" COMMIT");
                    Tr.debug(this, tc, stbuf.toString());
                }
            } 
        }

        ResourceException re = stateMgr.isValid(WSStateManager.LT_COMMIT);
        if (re == null) {
            // If no work was done during the transaction, the autoCommit value may still be
            // on.  In this case, just no-op, since some drivers like ConnectJDBC 3.1 don't
            // allow commit/rollback when autoCommit is on.  

            if (!currentAutoCommit)
                try { // autoCommit is off
                    sqlConn.commit();
                } catch (SQLException se) {
                    FFDCFilter.processException(se, "com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.processLocalTransactionCommittedEvent", "554", this);
                    throw AdapterUtil.translateSQLException(se, this, true, getClass());
                }

            //Set the state only after the commit has succeeded.  Else, we change the
            // state but it has not yet been committed. - a real mess

            // Already validated the state so just set it. 
            stateMgr.transtate = WSStateManager.NO_TRANSACTION_ACTIVE;
        } else {
            throw re;
        }

        // Fill in the ConnectionEvent only if needed. 
        connEvent.recycle(ConnectionEvent.LOCAL_TRANSACTION_COMMITTED, null, handle);

        if (isTraceOn && tc.isEventEnabled())
            Tr.event(this, tc, 
                     "Firing LOCAL TRANSACTION COMMITTED event for: " + handle,
                     this);

        // loop through the listeners
        for (int i = 0; i < numListeners; i++) {
            // send Local Transaction Committed event to the current listener
            ivEventListeners[i].localTransactionCommitted(connEvent); 
        }

        // Reset the indicator so lazy enlistment will be signaled if we end up in a
        // Global Transaction. 
        wasLazilyEnlistedInGlobalTran = false;

        // Replace ConnectionEvent caching with a single reusable instance per
        // ManagedConnection. 

        if (isTraceOn && tc.isEntryEnabled()) 
        {
            Tr.exit(this, tc, "processLocalTransactionCommittedEvent");
        }
    }
859851
private void beginInternTransaction()
    {
        if (log.isDebugEnabled()) log.debug("beginInternTransaction was called");
        J2EETransactionImpl tx = (J2EETransactionImpl) super.currentTransaction();
        if (tx == null) tx = newInternTransaction();
        if (!tx.isOpen())
        {
            // start the transaction
            tx.begin();
            tx.setInExternTransaction(true);
        }
    }
1334652
@Override
	public void commit() {
		Optional<LocalTransactionContext> txContext = currentTxContext();
		if (txContext.isPresent()) {
			txContext.get().commit();
		} else {
			this.unmanagedTransaction.ifPresent(LocalTransactionContext::commit);
		}
	}
857720
public function beginTransaction()
    {
        try {
            $this->connection->beginTransaction();
        } catch (DBALException $e) {
            throw new QueryException($e->getMessage(), $e->getCode(), $e);
        }
    }
73224
@Override
    public void begin()
    {
        if (isActive())
        {
            throw new IllegalStateException("Transaction is already active");
        }
        else
        {
            this.coordinator = ((EntityManagerImpl) entityManager).getPersistenceDelegator().getCoordinator();
            ((EntityManagerImpl) entityManager).getPersistenceDelegator().begin(); // transaction
                                                                                   // de-marcation.
            this.coordinator.coordinate(TxAction.BEGIN);
        }
    }
875321
@Override
	public void begin() throws TransactionManagementException {
		logger.entering(CLASSNAME, "begin");
		
		try {
			userTran.begin();
			logger.log(Level.FINE, "javax.transaction.Status: {0}", userTran.getStatus());
		} catch (NotSupportedException e) {
			throw new TransactionManagementException(e);
		} catch (SystemException e) {
			throw new TransactionManagementException(e);
		}
		logger.exiting(CLASSNAME, "begin");
	}
1340408
public LocalTransaction getOrCreateLocalTransaction(Transaction transaction, boolean implicitTransaction, Supplier<GlobalTransaction> gtxFactory) {
      LocalTransaction current = localTransactions.get(transaction);
      if (current == null) {
         if (!running) {
            // Assume that we wouldn't get this far if the cache was already stopped
            throw log.cacheIsStopping(cacheName);
         }
         GlobalTransaction tx = gtxFactory.get();
         current = txFactory.newLocalTransaction(transaction, tx, implicitTransaction, currentTopologyId);
         if (trace) log.tracef("Created a new local transaction: %s", current);
         localTransactions.put(transaction, current);
         globalToLocalTransactions.put(current.getGlobalTransaction(), current);
         if (notifier.hasListener(TransactionRegistered.class)) {
            // TODO: this should be allowed to be async at some point
            CompletionStages.join(notifier.notifyTransactionRegistered(tx, true));
         }
      }
      return current;
   }
225602
@Override
    public SIUncoordinatedTransaction createUncoordinatedTransaction(boolean allowSubordinateResources)
                    throws SIConnectionUnavailableException, SIConnectionDroppedException,
                    SIErrorException
    {
        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.entry(CoreSPIConnection.tc, "createUncoordinatedTransaction",
                        new Object[] { this, Boolean.valueOf(allowSubordinateResources) });

        LocalTransaction tran = null;

        // Synchronize on the close object, we don't want the connection closing
        // while we try to add the transaction.
        synchronized (this)
        {
            // See if this connection has been closed
            checkNotClosed();
            checkMPStarted();

            //Get a LocalTransaction from the message store (via the MP).
            tran = _txManager.createLocalTransaction(!allowSubordinateResources);

            synchronized (_ownedTransactions)
            {
                // Add this transaction to the connections list in case we need to
                // clean them up at close time.
                _ownedTransactions.add(tran);
                tran.registerCallback(this);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.exit(CoreSPIConnection.tc, "createUncoordinatedTransaction", tran);

        return tran;
    }