Set the isolation level for the current transacion and ensure
that it has not changed within the transaction.
8609
protected void setIsolationLevel(int isolationLevel)
                    throws IsolationLevelChangeException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
        {
            Tr.event(tc, "current isolation level = "
                         + MethodAttribUtils.getIsolationLevelString(ivIsolationLevel)
                         + ", attempting to change to = "
                         + MethodAttribUtils.getIsolationLevelString(isolationLevel)); // PK31372
        }

        // Treat TRANSACTION_NONE as "don't care".  The current value may be
        // NONE because it hasn't been set yet, or because all the methods
        // invoked so far did not have an isolation level specified by
        // the customer (in the deployment descriptor).                 d107762
        if (ivIsolationLevel == java.sql.Connection.TRANSACTION_NONE) {
            ivIsolationLevel = isolationLevel;
        } else if (ivIsolationLevel != isolationLevel &&
                   isolationLevel != java.sql.Connection.TRANSACTION_NONE) {
            throw new IsolationLevelChangeException();
        }
    }
327061
final public function beginTransaction(int $isolation = Transaction::ISOLATION_COMMITTED): Promise
    {
        if (! $this->handle) {
            throw new FailureException('Not connected');
        }

        return call(function () use ($isolation) {
            switch ($isolation) {
                case Transaction::ISOLATION_UNCOMMITTED:
                    yield $this->handle->query("BEGIN TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");
                    break;

                case Transaction::ISOLATION_COMMITTED:
                    yield $this->handle->query("BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED");
                    break;

                case Transaction::ISOLATION_REPEATABLE:
                    yield $this->handle->query("BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ");
                    break;

                case Transaction::ISOLATION_SERIALIZABLE:
                    yield $this->handle->query("BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE");
                    break;

                default:
                    throw new \Error("Invalid transaction type");
            }

            $this->busy = new Deferred;

            return new ConnectionTransaction($this->handle, $this->callableFromInstanceMethod("release"), $isolation);
        });
    }
294182
public function setTransactionIsolation($isolation)
    {
        if (!$this->getPlatform()->supportTransactionIsolations()) {
            throw ConnectionException::transactionIsolationNotSupported();
        }

        $this->executeUpdate($this->getPlatform()->getSetTransactionIsolationSQLQuery($isolation));
        $this->transactionIsolation = $isolation;
    }
1172358
public SQLTransaction beginTransaction(IsolationLevel isolationLevel, boolean forUpdateOnly) {
        N.checkArgNotNull(isolationLevel, "isolationLevel");

        isolationLevel = isolationLevel == IsolationLevel.DEFAULT ? _defaultIsolationLevel : isolationLevel;

        final String ttid = getTransactionThreadId();
        SQLTransaction transaction = threadTransactionMap.get(ttid);

        if (transaction == null) {
            transaction = new SQLTransaction(this, isolationLevel);
            threadTransactionMap.put(ttid, transaction);

            logger.info("Creating a new transaction(id={})", transaction.id());

        } else {
            logger.info("Reusing existing transaction(id={})", transaction.id());
        }

        logger.debug("Current active transactions: {}", threadTransactionMap.values());

        transaction.incrementAndGetRef(isolationLevel, forUpdateOnly);

        return transaction;
    }
743560
private function prepareTransaction()
    {
        $this->transaction->setSpanCount([
            'started' => count($this->spans)
        ]);

        if (empty($this->transaction->getContext()) || empty($this->spans)) {
            $this->transaction->setSampled(false);
        }
    }
1173010
public void remoteTransactionCommitted(GlobalTransaction gtx, boolean onePc) {
      boolean optimisticWih1Pc = onePc && (configuration.transaction().lockingMode() == LockingMode.OPTIMISTIC);
      if (configuration.transaction().transactionProtocol().isTotalOrder() || optimisticWih1Pc) {
         removeRemoteTransaction(gtx);
      }
   }
1104692
public void setRunningStatusIfNecessary() {
        if (ConnectionStatus.TRANSACTION != status.get() && ConnectionStatus.RUNNING != status.get()) {
            status.getAndSet(ConnectionStatus.RUNNING);
        }
    }
1278719
public void resetStateAfterFailover(long maxRows, int transactionIsolationLevel, String database,
      boolean autocommit) throws SQLException {
    setMaxRows(maxRows);

    if (transactionIsolationLevel != 0) {
      setTransactionIsolation(transactionIsolationLevel);
    }

    if (database != null && !"".equals(database) && !getDatabase().equals(database)) {
      setCatalog(database);
    }

    if (getAutocommit() != autocommit) {
      executeQuery("set autocommit=" + (autocommit ? "1" : "0"));
    }
  }
195976
public void setTransactionIsolation(final int level) throws SQLException {
    cmdPrologue();
    lock.lock();
    try {
      String query = "SET SESSION TRANSACTION ISOLATION LEVEL";
      switch (level) {
        case Connection.TRANSACTION_READ_UNCOMMITTED:
          query += " READ UNCOMMITTED";
          break;
        case Connection.TRANSACTION_READ_COMMITTED:
          query += " READ COMMITTED";
          break;
        case Connection.TRANSACTION_REPEATABLE_READ:
          query += " REPEATABLE READ";
          break;
        case Connection.TRANSACTION_SERIALIZABLE:
          query += " SERIALIZABLE";
          break;
        default:
          throw new SQLException("Unsupported transaction isolation level");
      }
      executeQuery(query);
      transactionIsolationLevel = level;
    } finally {
      lock.unlock();
    }
  }
1212076
void detach() {
        mLock.lock();
        try {
            if (mDetached || mTxnMgr.removeLocalScope(this)) {
                mDetached = true;
            } else {
                throw new IllegalStateException("Transaction is attached to a different thread");
            }
        } finally {
            mLock.unlock();
        }
    }
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);
			}
		}
	}
957549
public function setKeepAlive($b)
    {
        $this->_keepAlive = (boolean)$b;
        if (!$this->_keepAlive && $this->_sock) {
            fclose($this->_sock);
        }
    }
480655
@Override
    public synchronized void setCorrupt(boolean newCorrupt)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "setCorrupt", Boolean.valueOf(newCorrupt));

        boolean oldCorrupt = _isCorruptOrIndoubt;
        _isCorruptOrIndoubt = newCorrupt;

        // PK54812 We need to pass this through to the destination manager to
        // actually change the state of the destination.
        if (newCorrupt && !oldCorrupt)
        {
            destinationManager.corruptDestination(this);

            // Log a message with details of the destination that is corrupt
            SibTr.info(tc_cwsik, "DELIVERY_ERROR_SIRC_27",
                       new Object[] { getName() + " " + getUuid().toString() });
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "setCorrupt");
    }
1360394
public void attach() {
        mLock.lock();
        try {
            if (mTxnMgr.setLocalScope(this, mDetached)) {
                mDetached = false;
            } else if (!mDetached) {
                throw new IllegalStateException("Transaction scope is not detached");
            } else {
                throw new IllegalStateException
                    ("Current thread has a different transaction already attached");
            }
        } finally {
            mLock.unlock();
        }
    }
1287201
private void setConsistencylevel(Object value)
    {
        if (value instanceof String)
        {
            this.cassandraClientBase.setConsistencyLevel(ConsistencyLevel.valueOf((String) value));
        }
        else if (value instanceof ConsistencyLevel)
        {
            this.cassandraClientBase.setConsistencyLevel((ConsistencyLevel) value);
        }

    }
265259
public void setStatus(BounceProxyStatus status) throws IllegalStateException {
        // this checks if the transition is valid
        if (this.status.isValidTransition(status)) {
            this.status = status;
        } else {
            throw new IllegalStateException("Illegal status transition from " + this.status + " to " + status);
        }
    }
140536
public final int getTransactionIsolation() 
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) 
        {
            try {
                Tr.debug(this, tc, "The current isolation level from our tracking is: ", currentTransactionIsolation);
                Tr.debug(this, tc, "Isolation reported by the JDBC driver: ", sqlConn.getTransactionIsolation());
            } catch (Throwable x) {
                // NO FFDC needed
                // do nothing as we are taking the isolation level here for debugging reasons only
            }
        }

        return currentTransactionIsolation;
    }