public void unlock(String lockName) { final LockID lockID = lockManager.lockIDFor(lockName); if (lockID != null) { lockManager.unlock(lockID); getThreadTransactionContext().removeLock(lockID); } }
private boolean commitInternal( LockID lockID, ClientTransaction currentTransaction, boolean isWaitContext) { Assert.assertNotNull("transaction", currentTransaction); try { disableTransactionLogging(); // If the current transactionContext is READ_ONLY, there is no need to commit. TransactionContext tc = peekContext(lockID); if (tc.getType().equals(TxnType.READ_ONLY)) { txMonitor.committedReadTransaction(); return false; } boolean hasPendingCreateObjects = objectManager.hasPendingCreateObjects(); if (hasPendingCreateObjects) { objectManager.addPendingCreateObjectsToTransaction(); } currentTransaction.setAlreadyCommitted(); if (currentTransaction.hasChangesOrNotifies() || hasPendingCreateObjects) { if (txMonitor.isEnabled()) { currentTransaction.updateMBean(txMonitor); } remoteTxManager.commit(currentTransaction); } return true; } finally { enableTransactionLogging(); // always try to unlock even if we are throwing an exception // if (!isWaitContext && !currentTransaction.isNull()) { // lockManager.unlock(currentTransaction.getLockID()); // } if (!isWaitContext && !currentTransaction.isNull()) { if (lockID != null && !lockID.isNull()) { lockManager.unlock(lockID); } else { throw new AssertionError("Trying to unlock with lockID = null!"); } } } }