Beispiel #1
0
        void IEnlistmentNotification.Prepare(PreparingEnlistment preparingEnlistment)
        {
            bool flag = false;

            try
            {
                IAsyncResult result = new PrepareAsyncResult(this, handleEndPrepare, preparingEnlistment);
                if (result.CompletedSynchronously)
                {
                    PrepareAsyncResult.End(result);
                    preparingEnlistment.Prepared();
                }
                flag = true;
            }
            catch (TransactionException)
            {
            }
            finally
            {
                if (!flag)
                {
                    preparingEnlistment.ForceRollback();
                }
            }
        }
Beispiel #2
0
        void IEnlistmentNotification.Prepare(PreparingEnlistment preparingEnlistment)
        {
            bool success = false;

            try
            {
                IAsyncResult result = new PrepareAsyncResult(this, TransactionContext.handleEndPrepare, preparingEnlistment);
                if (result.CompletedSynchronously)
                {
                    PrepareAsyncResult.End(result);
                    preparingEnlistment.Prepared();
                }
                success = true;
            }
            //we need to swollow the TransactionException as it could because another party aborting it
            catch (TransactionException)
            {
            }
            finally
            {
                if (!success)
                {
                    preparingEnlistment.ForceRollback();
                }
            }
        }
Beispiel #3
0
        private static void HandleEndPrepare(IAsyncResult result)
        {
            PreparingEnlistment asyncState = (PreparingEnlistment)result.AsyncState;
            bool flag = false;

            try
            {
                if (!result.CompletedSynchronously)
                {
                    PrepareAsyncResult.End(result);
                    asyncState.Prepared();
                }
                flag = true;
            }
            catch (TransactionException)
            {
            }
            finally
            {
                if (!flag)
                {
                    asyncState.ForceRollback();
                }
            }
        }
Beispiel #4
0
        static void HandleEndPrepare(IAsyncResult result)
        {
            PreparingEnlistment preparingEnlistment = (PreparingEnlistment)result.AsyncState;
            bool success = false;

            try
            {
                if (!result.CompletedSynchronously)
                {
                    PrepareAsyncResult.End(result);
                    preparingEnlistment.Prepared();
                }
                success = true;
            }
            //we need to swollow the TransactionException as it could because another party aborting it
            catch (TransactionException)
            {
            }
            finally
            {
                if (!success)
                {
                    preparingEnlistment.ForceRollback();
                }
            }
        }