예제 #1
0
        public void Commit(string txId)
        {
            if (TransactionalStorage.SupportsDtc == false)
            {
                throw new InvalidOperationException("DTC is not supported by " + TransactionalStorage.FriendlyName + " storage.");
            }

            try
            {
                using (DocumentLock.Lock())
                {
                    try
                    {
                        inFlightTransactionalState.Commit(txId);
                        Log.Debug("Commit of tx {0} completed", txId);
                        workContext.ShouldNotifyAboutWork(() => "DTC transaction commited");
                    }
                    finally
                    {
                        inFlightTransactionalState.Rollback(txId);                         // this is where we actually remove the tx
                    }
                }
            }
            catch (Exception e)
            {
                if (TransactionalStorage.HandleException(e))
                {
                    return;
                }

                throw;
            }
            finally
            {
                workContext.HandleWorkNotifications();
            }
        }