public void Prepare(PreparingEnlistment preparingEnlistment) { if ((this.channel.TotalPendingItems > 0) || this.channel.sessiongramDoomed) { Exception e = DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("MsmqSessionChannelHasPendingItems"))); this.sessiongramReceiveContext.Abandon(TimeSpan.MaxValue); preparingEnlistment.ForceRollback(e); this.channel.Fault(); } else { Transaction current = Transaction.Current; try { Transaction.Current = this.transaction; try { this.sessiongramReceiveContext.Complete(TimeSpan.MaxValue); preparingEnlistment.Done(); } catch (MsmqException exception2) { preparingEnlistment.ForceRollback(exception2); this.channel.Fault(); } } finally { Transaction.Current = current; } } }
public void Prepare(PreparingEnlistment preparingEnlistment) { uint method = 0x4fe; this.TrEntry(method, new object[] { preparingEnlistment }); Exception e = null; bool flag = false; try { if (base.asyncFailureNotify != null) { base.TrText(method, "Rollback the tx as we have an async failure"); preparingEnlistment.ForceRollback(base.asyncFailureNotify); flag = true; } else { base.TrText(method, "Hconn =" + base.hconn.Value + " has been asked to Prepare by the Transaction Co-ordinator"); base.MQRMIXAEnd(); if (base.MQRMIXAPrepare(preparingEnlistment.RecoveryInformation()) == 3) { flag = true; preparingEnlistment.Done(); } else { base.TrText(method, "WMQ .NET is now prepared.."); preparingEnlistment.Prepared(); } } } catch (MQException exception2) { base.TrException(method, exception2, 1); e = exception2; preparingEnlistment.ForceRollback(e); flag = true; } catch (Exception exception3) { base.TrException(method, exception3, 2); e = exception3; preparingEnlistment.ForceRollback(e); flag = true; } finally { if (flag) { this.rmiTxComplete = true; if (base.hconn != null) { base.hconn.PulseCommitWait(); } } base.TrExit(method); } }
public void Prepare(PreparingEnlistment preparingEnlistment) { if ((this.channel.State == CommunicationState.Opened) && (this.channel.InternalPendingItems > 0)) { Exception e = DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("MsmqSessionChannelsMustBeClosed"))); preparingEnlistment.ForceRollback(e); this.channel.Fault(); } else { preparingEnlistment.Done(); } }
public void Prepare(PreparingEnlistment preparingEnlistment) { try { _transaction.IsValid(); } catch (Exception e) { preparingEnlistment.ForceRollback(e); return; } 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) { try { } catch { preparingEnlistment.ForceRollback(); } finally { 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(); } }
public void Prepare(PreparingEnlistment preparingEnlistment) { switch (_phase1Vote) { case Phase1Vote.Prepared: { if (_volatileEnlistDuringPrepare) { TestEnlistment newVol = new TestEnlistment(_phase1Vote, _expectedOutcome); try { _txToEnlist.EnlistVolatile(newVol, EnlistmentOptions.None); Assert.True(_expectEnlistToSucceed); } catch (Exception) { Assert.False(_expectEnlistToSucceed); } } preparingEnlistment.Prepared(); break; } case Phase1Vote.ForceRollback: { if (_outcomeReceived != null) { _outcomeReceived.Set(); } preparingEnlistment.ForceRollback(); break; } case Phase1Vote.Done: { if (_outcomeReceived != null) { _outcomeReceived.Set(); } preparingEnlistment.Done(); break; } } }
public void Prepare(PreparingEnlistment preparingEnlistment) { switch (_phase1Vote) { case Phase1Vote.Prepared: { preparingEnlistment.Prepared(); break; } case Phase1Vote.ForceRollback: { preparingEnlistment.ForceRollback(); break; } case Phase1Vote.Done: { preparingEnlistment.Done(); break; } } }
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; } } }
public async Task PrepareAsync(PreparingEnlistment preparingEnlistment) { using (await this.syncObject.LockAsync().Await()) { this.netTxState = TxState.Pending; try { Tracer.Debug("Prepare notification received for TX id: " + this.TransactionId); await BeforeEndAsync().Await(); // Before sending the request to the broker, log the recovery bits, if // this fails we can't prepare and the TX should be rolled back. RecoveryLogger.LogRecoveryInfo(this.TransactionId as XATransactionId, preparingEnlistment.RecoveryInformation()); // Inform the broker that work on the XA'sh TX Branch is complete. TransactionInfo info = new TransactionInfo(); info.ConnectionId = this.connection.ConnectionId; info.TransactionId = this.TransactionId; info.Type = (int)TransactionType.End; await this.connection.CheckConnectedAsync().Await(); await this.connection.SyncRequestAsync((TransactionInfo)info.Clone()).Await(); // Prepare the Transaction for commit. info.Type = (int)TransactionType.Prepare; IntegerResponse response = (IntegerResponse)await this.connection.SyncRequestAsync(info).Await(); if (response.Result == XA_READONLY) { Tracer.Debug("Transaction Prepare done and doesn't need a commit, TX id: " + this.TransactionId); this.TransactionId = null; this.currentEnlistment = null; // Read Only means there's nothing to recover because there was no // change on the broker. RecoveryLogger.LogRecovered(this.TransactionId as XATransactionId); // if server responds that nothing needs to be done, then reply done. // otherwise the DTC will call Commit or Rollback but another transaction // can already be in progress and this one would be commited or rolled back // immediately. preparingEnlistment.Done(); // Done so commit won't be called. AfterCommit(); // A Read-Only TX is considered closed at this point, DTC won't call us again. this.dtcControlEvent.Set(); } else { Tracer.Debug("Transaction Prepare succeeded TX id: " + this.TransactionId); // If work finished correctly, reply prepared preparingEnlistment.Prepared(); } } catch (Exception ex) { Tracer.DebugFormat("Transaction[{0}] Prepare failed with error: {1}", this.TransactionId, ex.Message); AfterRollback(); preparingEnlistment.ForceRollback(); try { this.connection.OnAsyncException(ex); } catch (Exception error) { Tracer.Error(error.ToString()); } this.currentEnlistment = null; this.TransactionId = null; this.netTxState = TxState.None; this.dtcControlEvent.Set(); } } }
public void Prepare(PreparingEnlistment preparingEnlistment) { preparingEnlistment.Done(); }
public void Prepare(PreparingEnlistment preparingEnlistment) { switch (_phase1Vote) { case Phase1Vote.Prepared: { if (_volatileEnlistDuringPrepare) { TestEnlistment newVol = new TestEnlistment(_phase1Vote, _expectedOutcome); try { _txToEnlist.EnlistVolatile(newVol, EnlistmentOptions.None); Assert.Equal(_expectEnlistToSucceed, true); } catch (Exception) { Assert.Equal(_expectEnlistToSucceed, false); } } preparingEnlistment.Prepared(); break; } case Phase1Vote.ForceRollback: { if (_outcomeReceived != null) { _outcomeReceived.Set(); } preparingEnlistment.ForceRollback(); break; } case Phase1Vote.Done: { if (_outcomeReceived != null) { _outcomeReceived.Set(); } preparingEnlistment.Done(); break; } } }
public void Prepare(PreparingEnlistment preparingEnlistment) { this.proxy.ClearTransaction(this); this.proxy = null; preparingEnlistment.Done(); }
public void Prepare(PreparingEnlistment preparingEnlistment) { Neo4jTransaction.DoKeepAlive(_transactionExecutionEnvironment); preparingEnlistment.Done(); }