コード例 #1
0
        private static void TimeoutCallback(object state)
        {
            TransactionWaitAsyncResult result = (TransactionWaitAsyncResult)state;

            if (result.dependentTransaction != null)
            {
                result.dependentTransaction.Complete();
            }
            result.Complete(false, new TimeoutException(System.ServiceModel.Activities.SR.TransactionPersistenceTimeout));
        }
コード例 #2
0
        static void TimeoutCallback(object state)
        {
            TransactionWaitAsyncResult thisPtr = (TransactionWaitAsyncResult)state;

            Fx.Assert(null != thisPtr, "TransactionWaitAsyncResult.TimeoutCallback called with an object that is not a TransactionWaitAsyncResult.");

            // As a general policy, we are not going to rollback the transaction because of this timeout. Instead, we are letting
            // the caller make the decision to rollback or not based on exception we are throwing. It could be that they could
            // tolerate the timeout and try something else and still commit the transaction.
            if (thisPtr.dependentTransaction != null)
            {
                thisPtr.dependentTransaction.Complete();
            }

            thisPtr.Complete(false, new TimeoutException(SR.TransactionPersistenceTimeout));
        }
コード例 #3
0
 internal bool QueueForTransactionLock(Transaction requestingTransaction, TransactionWaitAsyncResult txWaitAsyncResult)
 {
     lock (base.ThisLock)
     {
         if (this.lockingTransaction == 0)
         {
             if (null != requestingTransaction)
             {
                 this.lockingTransaction       = requestingTransaction.GetHashCode();
                 this.lockingTransactionObject = requestingTransaction.Clone();
             }
             return(true);
         }
         if ((null != requestingTransaction) && (this.lockingTransaction == requestingTransaction.GetHashCode()))
         {
             return(true);
         }
         this.transactionWaiterQueue.Enqueue(txWaitAsyncResult);
         return(false);
     }
 }
コード例 #4
0
        internal void ScheduleNextTransactionWaiter()
        {
            TransactionWaitAsyncResult result = null;
            bool flag = false;

            lock (base.ThisLock)
            {
                bool flag2 = false;
                if (0 < this.transactionWaiterQueue.Count)
                {
                    while ((0 < this.transactionWaiterQueue.Count) && !flag2)
                    {
                        result = this.transactionWaiterQueue.Dequeue();
                        if (null != result.Transaction)
                        {
                            this.lockingTransactionObject = result.Transaction;
                            this.lockingTransaction       = this.lockingTransactionObject.GetHashCode();
                        }
                        else
                        {
                            this.lockingTransaction       = 0;
                            this.lockingTransactionObject = null;
                        }
                        flag2 = result.Complete() || flag2;
                        if (this.Detaching)
                        {
                            flag           = true;
                            this.Detaching = false;
                        }
                        if (this.IsPermanentlyRemoved)
                        {
                            this.lockingTransaction       = 0;
                            this.lockingTransactionObject = null;
                            while (0 < this.transactionWaiterQueue.Count)
                            {
                                flag2 = this.transactionWaiterQueue.Dequeue().Complete() || flag2;
                            }
                        }
                        while (0 < this.transactionWaiterQueue.Count)
                        {
                            TransactionWaitAsyncResult result2 = this.transactionWaiterQueue.Peek();
                            if (this.lockingTransaction == 0)
                            {
                                if (null != result2.Transaction)
                                {
                                    this.lockingTransactionObject = result2.Transaction;
                                    this.lockingTransaction       = this.lockingTransactionObject.GetHashCode();
                                }
                            }
                            else if ((null == result2.Transaction) || (this.lockingTransaction != result2.Transaction.GetHashCode()))
                            {
                                continue;
                            }
                            flag2 = this.transactionWaiterQueue.Dequeue().Complete() || flag2;
                        }
                    }
                }
                if (!flag2)
                {
                    this.lockingTransaction       = 0;
                    this.lockingTransactionObject = null;
                }
            }
            if (flag)
            {
                this.directory.RemoveInstance(this, false);
            }
        }
コード例 #5
0
 internal void EndEnlist(IAsyncResult result)
 {
     TransactionWaitAsyncResult.End(result);
     base.ThrowIfDisposedOrNotOpen();
 }