Esempio n. 1
0
 public void Prepare(PreparingEnlistment preparingEnlistment)
 {
     lock (_sharedLock)
     {
         if (PrepareCommitAction != null) PrepareCommitAction();
     }
     preparingEnlistment.Done();
 }
 public void Prepare(PreparingEnlistment preparingEnlistment)
 {
     if (commit)
     {
         preparingEnlistment.Prepared();
     }
     else
     {
         preparingEnlistment.ForceRollback();
         // Rollback is not called after 'Rollback' vote
         this.WasRollback = true;
         preparingEnlistment.Done();
     }
 }
Esempio n. 3
0
 public void Prepare(PreparingEnlistment preparingEnlistment)
 {
     preparingEnlistment.Done();
 }
 public void Prepare(PreparingEnlistment preparingEnlistment)
 {
     Neo4jTransaction.DoKeepAlive(_transactionExecutionEnvironment);
     preparingEnlistment.Done();
 }
 public void Prepare(PreparingEnlistment preparingEnlistment)
 {
     // Abort if this happens before all messges are consumed
     if (this.channel.State == CommunicationState.Opened && this.channel.InternalPendingItems > 0)
     {
         Exception e = DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.MsmqSessionChannelsMustBeClosed)));
         preparingEnlistment.ForceRollback(e);
         this.channel.Fault();
     }
     else
     {
         preparingEnlistment.Done();
     }
 }
            public void Prepare(PreparingEnlistment preparingEnlistment)
            {
                // Abort if this happens before all messges are consumed
                // Note that we are not placing any restriction on the channel state
                if (this.channel.TotalPendingItems > 0 || this.channel.sessiongramDoomed)
                {
                    Exception e = DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.MsmqSessionChannelHasPendingItems)));
                    this.sessiongramReceiveContext.Abandon(TimeSpan.MaxValue);
                    preparingEnlistment.ForceRollback(e);
                    this.channel.Fault();
                }
                else
                {
                    Transaction savedTransaction = Transaction.Current;
                    // complete the sessiongram message within this transaction
                    try
                    {
                        Transaction.Current = this.transaction;

                        try
                        {
                            this.sessiongramReceiveContext.Complete(TimeSpan.MaxValue);
                            preparingEnlistment.Done();
                        }
                        catch (MsmqException msmqex)
                        {
                            preparingEnlistment.ForceRollback(msmqex);
                            this.channel.Fault();
                        }
                    }
                    finally
                    {
                        Transaction.Current = savedTransaction;
                    }
                }
            }