Releases all locks held by a transaction. If a lock is the last lock on
that block, then the waiting transactions are notified.

@param txNum
a transaction number

@param sLockOnly
release slocks only
433377
void releaseAll(long txNum, boolean sLockOnly) {
		Set<Object> objectsToRelease = getObjectSet(txNum);
		for (Object obj : objectsToRelease) {
			Object anchor = getAnchor(obj);
			synchronized (anchor) {
				Lockers lks = lockerMap.get(obj);

				if (lks != null) {

					if (hasSLock(lks, txNum))
						releaseLock(lks, anchor, txNum, S_LOCK);

					if (hasXLock(lks, txNum) && !sLockOnly)
						releaseLock(lks, anchor, txNum, X_LOCK);

					if (hasSixLock(lks, txNum))
						releaseLock(lks, anchor, txNum, SIX_LOCK);

					while (hasIsLock(lks, txNum))
						releaseLock(lks, anchor, txNum, IS_LOCK);

					while (hasIxLock(lks, txNum) && !sLockOnly)
						releaseLock(lks, anchor, txNum, IX_LOCK);

					// Remove the locker, if there is no other transaction
					// having it
					if (!sLocked(lks) && !xLocked(lks) && !sixLocked(lks)
							&& !isLocked(lks) && !ixLocked(lks)
							&& lks.requestSet.isEmpty())
						lockerMap.remove(obj);
				}
			}
		}
		txWaitMap.remove(txNum);
		txnsToBeAborted.remove(txNum);
		lockByMap.remove(txNum);
	}
1341377
@Override
	public void rollback() {
		Optional<LocalTransactionContext> txContext = currentTxContext();
		if (txContext.isPresent()) {
			txContext.get().rollback();
		} else {
			this.unmanagedTransaction.ifPresent(LocalTransactionContext::rollback);
		}
	}
736907
public boolean hasReadLock(TransactionImpl tx, Object obj)
    {
        checkTimedOutLocks();

        Identity oid = new Identity(obj,getBroker());
        String oidString = oid.toString();
		String txGuid = tx.getGUID();
        return hasReadLockInternal(oidString, txGuid);
    }
393659
@Override
	public void redo(Transaction tx) {
		Buffer buff = tx.bufferMgr().pin(blk);
		buff.setVal(offset, newVal, tx.getTransactionNumber(), null);
		tx.bufferMgr().unpin(buff);
	}
1125963
private void upgradeLockIfNeeded()
    {
        // using clone to avoid ConcurentModificationException
        Iterator iter = ((List) mvOrderOfIds.clone()).iterator();
        TransactionImpl tx = getTransaction();
        ObjectEnvelope mod;
        while(iter.hasNext())
        {
            mod = (ObjectEnvelope) mhtObjectEnvelopes.get(iter.next());
            // ignore transient objects
            if(!mod.getModificationState().isTransient())
            {
                /*
                now we check if all modified objects has a write lock. On insert of new
                objects we don't need a write lock.
                */
                if(!mod.needsInsert())
                {
                    if((mod.needsDelete() || mod.needsUpdate()
                            || mod.hasChanged(tx.getBroker())))
                    {
                        needsCommit = true;
                        // mark object dirty
                        mod.setModificationState(mod.getModificationState().markDirty());
                        ClassDescriptor cld = mod.getClassDescriptor();
                        // if the object isn't already locked, we will do it now
                        if(!mod.isWriteLocked())
                        {
                            tx.doSingleLock(cld, mod.getObject(), mod.getIdentity(), Transaction.WRITE);
                        }
                    }
                }
                else
                {
                    needsCommit = true;
                }
            }
        }
    }
1113818
public boolean releaseLock() {
        LockInfo info = (LockInfo)mLockInfoRef.get();
        int type = info.mType;
        int count = info.mCount;
        if (count > 0) {
            count--;
        }
        else {
            info.mType = type = NONE;
            count = 0;
        }

        if ((info.mCount = count) == 0) {
            switch (type) {
            case NONE: default:
                return false;

            case READ:
                synchronized (this) {
                    mReadLocks--;
                    notifyAll();
                }
                break;

            case UPGRADABLE:
                synchronized (this) {
                    mUpgradableLockHeld = null;
                    notifyAll();
                }
                break;

            case WRITE:
                synchronized (this) {
                    mWriteLockHeld = null;
                    notifyAll();
                }
                break;
            }

            info.mType = NONE;
        }
        else if (type == WRITE && info.mUpgradeCount == count) {
            // Convert write lock back into an upgradable lock.
            info.mType = UPGRADABLE;
            info.mUpgradeCount = 0;
            synchronized (this) {
                mWriteLockHeld = null;
                notifyAll();
            }
        }

        return true;
    }
438509
@Override
  public void close() {
    if (state == RELEASED) {
      return;
    }
    if (state == READY) {
      LIB.mdb_txn_abort(ptr);
    }
    keyVal.close();
    state = RELEASED;
  }
187323
function maybeReleaseLock() {
    var lock = self.client.lock;

    function done(err) {
      log.debug({client: self.client}, 'Closed client sync handler');
      self.client.lock = null;
      self.client = null;
      callback(err);
    }

    // No lock
    if(!lock) {
      return done();
    }
    // Lock reference, but it's already unlocked
    if(lock.unlocked) {
      return done();
    }
    // Holding lock, release it
    lock.release(function(err) {
      if(err) {
        log.error({err: err, client: self.client}, 'Error releasing sync lock');
        return done(err);
      }
      done();
    });
  }
193991
private void completeTransaction(final String txId, String wsName) {
        getWorkspace().clear();
        // reset the ws cache to the shared (global one)
        setWorkspaceCache(sharedWorkspaceCache());
        // and clear some tx specific data
        COMPLETE_FUNCTION_BY_TX_AND_WS.compute(txId, (transactionId, funcsByWsName) -> {
            funcsByWsName.remove(wsName);
            if (funcsByWsName.isEmpty()) {
                // this is the last ws cache we are clearing for this tx so mark all the keys as unlocked
                LOCKED_KEYS_BY_TX_ID.remove(txId);
                // and remove the map 
                return null;                
            }
            // there are other ws caches which need clearing for this tx, so just return the updated map
            return funcsByWsName;
        });  
    }
1334594
function (seq, release, done) {
      lockRelease = release
      latestSeq = seq

      hashNodesAndFindLinks(nodes, done)
    }
1362556
function TransactionTask(readOnly, txnCallback, errorCallback, successCallback) {
  this.readOnly = readOnly;
  this.txnCallback = txnCallback;
  this.errorCallback = errorCallback;
  this.successCallback = successCallback;
}
1062800
def release(self, lock_transactions=None):
        

        self.personal_lock.release()

        self.with_count -= 1

        if lock_transactions is None:
            lock_transactions = self.lock_transactions

        if not lock_transactions:
            self.db_state.lock.release()
            return

        try:
            # If the connection is closed, an exception is thrown
            in_transaction = self.in_transaction
        except sqlite3.ProgrammingError:
            in_transaction = False

        # The transaction lock should be released only if:
        # 1) the connection was previously in a transaction and now it isn't
        # 2) the connection wasn't previously in a transaction and still isn't
        if (self.was_in_transaction and not in_transaction) or not in_transaction:
            if self.with_count == 0: # This is for nested with statements
                self.db_state.active_connection = None
                self.db_state.transaction_lock.release()

        self.db_state.lock.release()
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();
        }
    }
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);
    }
336872
public boolean writeLock(TransactionImpl tx, Object obj)
    {
        LockEntry writer = getWriter(obj);
        if (writer == null)
        {
            if (setWriter(tx, obj))
                return true;
            else
                return writeLock(tx, obj);
        }
        if (writer.isOwnedBy(tx))
        {
            return true;    // If I'm the writer, then I can write.
        }
        return false;
    }
557326
private boolean cleanLockedObjects(ITransaction transaction,
            LockedObject lo, boolean temporary) {

        if (lo._children == null) {
            if (lo._owner == null) {
                if (temporary) {
                    lo.removeTempLockedObject();
                } else {
                    lo.removeLockedObject();
                }

                return true;
            } else {
                return false;
            }
        } else {
            boolean canDelete = true;
            int limit = lo._children.length;
            for (int i = 0; i < limit; i++) {
                if (!cleanLockedObjects(transaction, lo._children[i], temporary)) {
                    canDelete = false;
                } else {

                    // because the deleting shifts the array
                    i--;
                    limit--;
                }
            }
            if (canDelete) {
                if (lo._owner == null) {
                    if (temporary) {
                        lo.removeTempLockedObject();
                    } else {
                        lo.removeLockedObject();
                    }
                    return true;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        }
    }
643180
public void removeLocked( MessageLock lockRef ) throws JMSException
    {
    	checkTransactionLock();
    	
    	MessageStore targetStore;
    	if (lockRef.getDeliveryMode() == DeliveryMode.NON_PERSISTENT)
    	    targetStore = volatileStore;
    	else
    	{
    	    targetStore = persistentStore;
    	    if (requiresTransactionalUpdate())
    	    	pendingChanges = true;
    	}
    	
    	synchronized (storeLock)
        {
    		targetStore.delete(lockRef.getHandle());
        }
    }