<p>
Sets the XID identifying the transaction if has not been set already.
No check is made on the uniqueness of the XID.

@param XID the Xopen identifier of the transaction, or null.
</p>
@throws ObjectManagerException
341995
protected synchronized void setXID(byte[] XID)
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) {
            trace.entry(this,
                        cclass,
                        "setXID",
                        XID);
            trace.bytes(this,
                        cclass,
                        XID);
        } // if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()).

        if (logicalUnitOfWork.XID != null) {
            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this, cclass
                           , "setXID"
                           , "via XIDModificationException"
                             + " logicalUnitOfWork.XID=" + logicalUnitOfWork.XID + "(byte[])"
                                );
            throw new XIDModificationException(this
                                               , logicalUnitOfWork.XID
                                               , XID);
        } // if (logicalUnitOfWork.XID != null).

        if (XID.length > LogicalUnitOfWork.maximumXIDSize) {
            if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
                trace.debug(this, cclass
                            , "setXID"
                            , "via XIDTooLongException"
                              + " XID.length=" + XID.length + "(byte[])"
                                );
            throw new XIDTooLongException(this
                                          , XID.length);
        } // if (logicalUnitOfWork.XID != null).

        // No need to reserve extra space in the log for the XID in Commit/Backout
        // and Checkpoint logRecords because we already assumed the maximumSerializedSize
        // when the transaction wrote its fitrst LogRecord.

        logicalUnitOfWork.XID = new byte[XID.length];
        System.arraycopy(XID, 0, logicalUnitOfWork.XID, 0, XID.length);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass
                       , "setXID"
                            );
    }
1325300
void closeTransactionalBranch(Xid xid) {

        if (this.transactionBinding.getTransactionBindingType() != TransactionBindingType.GlobalTransaction) {
            throw new IllegalStateException("XAConnection not associated to a global transaction");
        }

        GlobalTransactionProxy<C> globalTransactionProxy = this.transactionBinding.getEnlistedGlobalTransaction();
        globalTransactionProxy.close();

        delistTransaction();
    }
929419
private void visitTxId() throws IOException {
    if (LayoutVersion.supports(Feature.STORED_TXIDS, editsVersion)) {
      v.visitLong(EditsElement.TRANSACTION_ID);
    }
  }
502535
public function commit($xid)
    {
        if ($this->activeTransaction != $xid || $this->activeTransaction === false) {
            return;
        }

        $this->activeTransaction = false;

        if (!$this->connection->commit()) {
            throw new DbException("Commit failed");
        }
    }
668125
public void setObjectType(final byte[] objectType) {
        this.objectType = objectType == null || objectType.length == 0
                ? null
                : Arrays.copyOf(objectType, objectType.length);
    }
1363718
@Override
    public void forget(final Xid _xid)
    {
        if (JDBCStoreResource.LOG.isDebugEnabled()) {
            JDBCStoreResource.LOG.debug("forget (xid = " + _xid + ")");
        }
    }
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));

        }

    }
1035540
public void assignID(XAttributable element, XID id) {
		if (id != null) {
			XAttributeID attr = (XAttributeID) ATTR_ID.clone();
			attr.setValue(id);
			element.getAttributes().put(KEY_ID, attr);
		}
	}
227033
public BaseLuceneStorage setIndexManager(IndexManager indexManager) {
        if (this.indexManager != null && myOwnIndexManager) {
            this.indexManager.close();
            myOwnIndexManager = false;
        }
        this.indexManager = indexManager;
        return this;
    }
1108954
@Override
  public int prepare(Xid xid) throws XAException {
    if (logger.logDebug()) {
      debug("preparing transaction xid = " + xid);
    }

    // Check preconditions
    if (!currentXid.equals(xid)) {
      throw new CloudSpannerXAException(CloudSpannerXAException.PREPARE_WITH_SAME,
          Code.UNIMPLEMENTED, XAException.XAER_RMERR);
    }
    if (state != STATE_ENDED) {
      throw new CloudSpannerXAException(CloudSpannerXAException.PREPARE_BEFORE_END,
          Code.FAILED_PRECONDITION, XAException.XAER_INVAL);
    }

    state = STATE_IDLE;
    currentXid = null;

    try {
      String s = RecoveredXid.xidToString(xid);
      conn.prepareTransaction(s);
      conn.setAutoCommit(localAutoCommitMode);

      return XA_OK;
    } catch (CloudSpannerSQLException ex) {
      throw new CloudSpannerXAException(CloudSpannerXAException.ERROR_PREPARING, ex,
          XAException.XAER_RMERR);
    } catch (SQLException ex) {
      throw new CloudSpannerXAException(CloudSpannerXAException.ERROR_PREPARING, ex, Code.UNKNOWN,
          XAException.XAER_RMERR);
    }
  }
1332163
public boolean setWriter(TransactionImpl tx, Object obj)
    {
        checkTimedOutLocks();

        Identity oid = new Identity(obj, tx.getBroker());
        LockEntry writer = new LockEntry(oid.toString(),
                tx.getGUID(),
                System.currentTimeMillis(),
                LockStrategyFactory.getIsolationLevel(obj),
                LockEntry.LOCK_WRITE);
        String oidString = oid.toString();
        setWriterInternal(writer, oidString);
        return true;
    }
1161395
public boolean add(Token token,
                       Transaction transaction)
                    throws ObjectManagerException
    {
        List.Entry entry = addEntry(token, transaction);
        return (entry != null);
    }
445235
protected void writeObject(java.io.DataOutputStream dataOutputStream)
                    throws ObjectManagerException, java.io.IOException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this
                        , cclass
                        , "writeObject"
                        , new Object[] { dataOutputStream }
                            );

        try {
            dataOutputStream.writeByte(simpleSerialVersion);

        } catch (java.io.IOException exception) {
            // No FFDC Code Needed.
            ObjectManager.ffdc.processException(this, cclass, "writeObject", exception, "1:2111:1.34");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this
                           , cclass
                           , "writeObject"
                           , "via PermanentIOException"
                                );
            throw new PermanentIOException(this,
                                           exception);
        } // catch (java.io.IOException exception).

        // We cannot check size as we are subclassed.

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       "writeObject");
    }
982074
@Override
	public final void setClientID(String clientID) throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
    	{
	        super.setClientID(clientID);
	        try
	        {
	        	ClientIDRegistry.getInstance().register(clientID);
	        }
	        catch (JMSException e)
	        {
	        	this.clientID = null; // Clear client ID
	        	throw e;
	        }
    	}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
583741
protected void setId(String id) {
		if (!StringUtils.hasText(id)) {
			id = null;
		}
		this.id = id;
	}
1122980
@Override
  public final void setItsId(final BuyerPriceCategoryId pItsId) {
    this.itsId = pItsId;
    if (this.itsId != null) {
      this.priceCategory = this.itsId.getPriceCategory();
      this.buyer = this.itsId.getBuyer();
    } else {
      this.priceCategory = null;
      this.buyer = null;
    }
  }
785498
public void rollback(final Xid xid) throws XAException {

        final String methodName = "rollback";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName, xid);
        }

        _siXaResource.rollback(xid);

        // Add the value true to indicate we have rolled back to the hashtable of
        // stats (keying off the xid)
        synchronized (_transactionStates) {

          _transactionStates.put (xid, Boolean.TRUE);

          if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
            StringBuffer sb = new StringBuffer ("After adding the xid ");
            sb.append (xid);
            sb.append (" the hashtable of transactionStates now contains ");
            sb.append (_transactionStates.size());
            sb.append (" entries");
            SibTr.debug (this, TRACE, sb.toString());
          }

        }

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

    }