当前位置: 首页>>代码示例>>C#>>正文


C# PreparingEnlistment.RecoveryInformation方法代码示例

本文整理汇总了C#中System.Transactions.PreparingEnlistment.RecoveryInformation方法的典型用法代码示例。如果您正苦于以下问题:C# PreparingEnlistment.RecoveryInformation方法的具体用法?C# PreparingEnlistment.RecoveryInformation怎么用?C# PreparingEnlistment.RecoveryInformation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Transactions.PreparingEnlistment的用法示例。


在下文中一共展示了PreparingEnlistment.RecoveryInformation方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Prepare

        public virtual void Prepare(PreparingEnlistment preparingEnlistment)
        {
            Trace.WriteIf(Tracing.Is.TraceVerbose, string.Empty);
            if (null == preparingEnlistment)
            {
                return;
            }

            try
            {
                Operation.Info = Convert.ToBase64String(preparingEnlistment.RecoveryInformation());
                if (ConfigureOperation() &&
                    Operation.Do())
                {
                    Trace.WriteIf(Tracing.Is.TraceVerbose, "preparingEnlistment.Prepared()");
                    preparingEnlistment.Prepared();
                    return;
                }

                Trace.WriteIf(Tracing.Is.TraceVerbose, "preparingEnlistment.ForceRollback()");
                preparingEnlistment.ForceRollback();
            }
            catch (Exception exception)
            {
                Trace.TraceError("{0}", exception);
                preparingEnlistment.ForceRollback(exception);
            }
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:28,代码来源:DurableEnlistmentNotification.cs

示例2: Prepare

		/// <summary>
		/// Notifies an enlisted object that a transaction is being prepared for commitment.
		/// </summary>
		/// <param name="preparingEnlistment">A <see cref="T:System.Transactions.PreparingEnlistment"/> object used to send a response to the transaction manager.</param>
		public void Prepare(PreparingEnlistment preparingEnlistment)
		{
			onTxComplete();
			try
			{
				using (var machineStoreForApplication = IsolatedStorageFile.GetMachineStoreForDomain())
				{
					var name = TransactionRecoveryInformationFileName;
					using (var file = machineStoreForApplication.CreateFile(name + ".temp"))
					using(var writer = new BinaryWriter(file))
					{
						writer.Write(session.ResourceManagerId.ToString());
						writer.Write(PromotableRavenClientEnlistment.GetLocalOrDistributedTransactionId(transaction).ToString());
						writer.Write(session.DatabaseName ?? "");
						writer.Write(preparingEnlistment.RecoveryInformation());
						file.Flush(true);
					}
					machineStoreForApplication.MoveFile(name + ".temp", name);
			}
			}
			catch (Exception e)
			{
				logger.ErrorException("Could not prepare distributed transaction", e);
				preparingEnlistment.ForceRollback(e);
				return;
			}
			preparingEnlistment.Prepared();
		}
开发者ID:remcoros,项目名称:ravendb,代码行数:32,代码来源:RavenClientEnlistment.cs

示例3: Prepare

		/// <summary>
		/// Notifies an enlisted object that a transaction is being prepared for commitment.
		/// </summary>
		/// <param name="preparingEnlistment">A <see cref="T:System.Transactions.PreparingEnlistment"/> object used to send a response to the transaction manager.</param>
		public void Prepare(PreparingEnlistment preparingEnlistment)
		{
			onTxComplete();
			session.StoreRecoveryInformation(session.ResourceManagerId, PromotableRavenClientEnlistment.GetLocalOrDistributedTransactionId(transaction), 
				preparingEnlistment.RecoveryInformation());
			preparingEnlistment.Prepared();
		}
开发者ID:nzdunic,项目名称:ravendb,代码行数:11,代码来源:RavenClientEnlistment.cs

示例4: Prepare

		/// <summary>
		/// Notifies an enlisted object that a transaction is being prepared for commitment.
		/// </summary>
		/// <param name="preparingEnlistment">A <see cref="T:System.Transactions.PreparingEnlistment"/> object used to send a response to the transaction manager.</param>
		public void Prepare(PreparingEnlistment preparingEnlistment)
		{
			try
			{

				onTxComplete();
				ctx.CreateFile(TransactionRecoveryInformationFileName, stream =>
				{
					var writer = new BinaryWriter(stream);
					writer.Write(session.ResourceManagerId.ToString());
					writer.Write(transaction.LocalIdentifier);
					writer.Write(session.DatabaseName ?? "");
					writer.Write(preparingEnlistment.RecoveryInformation());
				});

				session.PrepareTransaction(transaction.LocalIdentifier); 
			}
			catch (Exception e)
			{
				logger.ErrorException("Could not prepare distributed transaction", e);
			    try
			    {
                    session.Rollback(transaction.LocalIdentifier);
                    DeleteFile();
			    }
			    catch (Exception e2)
			    {
			        logger.ErrorException("Could not roll back transaction after prepare failed", e2);
			    }

				preparingEnlistment.ForceRollback(e);
				return;
			}
			preparingEnlistment.Prepared();
		}
开发者ID:925coder,项目名称:ravendb,代码行数:39,代码来源:RavenClientEnlistment.cs

示例5: Prepare

			public void Prepare(PreparingEnlistment preparingEnlistment)
			{
				byte[] recoveryInformation = preparingEnlistment.RecoveryInformation();
				var ravenJObject = new RavenJObject
				{
					{Constants.NotForReplication, true}
				};
				database.PutStatic("transactions/recoveryInformation/" + txId, null, new MemoryStream(recoveryInformation), ravenJObject);
				preparingEnlistment.Prepared();
			}
开发者ID:bstrausser,项目名称:ravendb,代码行数:10,代码来源:PendingTransactionRecovery.cs

示例6: Prepare

 public void Prepare(PreparingEnlistment preparingEnlistment)
 {
     _assertNotDisposed();
     _logger.Debug("Preparing enlistment with id: {0}", Id);
     var information = preparingEnlistment.RecoveryInformation();
     _queueStorage.Global(actions =>
     {
         actions.RegisterRecoveryInformation(Id, information);
     });
     preparingEnlistment.Prepared();
     _logger.Debug("Prepared enlistment with id: {0}", Id);
 }
开发者ID:JackGilliam1,项目名称:LightningQueues,代码行数:12,代码来源:TransactionEnlistment.cs

示例7: Prepare

		/// <summary>
		/// Notifies an enlisted object that a transaction is being prepared for commitment.
		/// </summary>
		/// <param name="preparingEnlistment">A <see cref="T:System.Transactions.PreparingEnlistment"/> object used to send a response to the transaction manager.</param>
		public void Prepare(PreparingEnlistment preparingEnlistment)
		{
			onTxComplete();
			try
			{
				session.StoreRecoveryInformation(session.ResourceManagerId, PromotableRavenClientEnlistment.GetLocalOrDistributedTransactionId(transaction), 
				                                 preparingEnlistment.RecoveryInformation());
			}
			catch (Exception e)
			{
				logger.ErrorException("Could not prepare distributed transaction", e);
				preparingEnlistment.ForceRollback(e);
				return;
			}
			preparingEnlistment.Prepared();
		}
开发者ID:JPT123,项目名称:ravendb,代码行数:20,代码来源:RavenClientEnlistment.cs

示例8: Prepare

			public void Prepare(PreparingEnlistment preparingEnlistment)
			{
				database.PutStatic("transactions/recoveryInformation/" + txId, null, preparingEnlistment.RecoveryInformation(), new JObject());
				preparingEnlistment.Prepared();
			}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:5,代码来源:PendingTransactionRecovery.cs

示例9: GetRecoveryInformation

 public byte[] GetRecoveryInformation(PreparingEnlistment preparingEnlistment)
 {
     return preparingEnlistment.RecoveryInformation();
 }
开发者ID:IdanHaim,项目名称:ravendb,代码行数:4,代码来源:LocalDirectoryTransactionRecoveryStorage.cs

示例10: Prepare

 public void Prepare(PreparingEnlistment preparingEnlistment)
 {
 	session.StoreRecoveryInformation(PromotableRavenClientEnlistment.GetLocalOrDistributedTransactionId(transaction), preparingEnlistment.RecoveryInformation());
     preparingEnlistment.Prepared();
 }
开发者ID:ajaishankar,项目名称:ravendb,代码行数:5,代码来源:RavenClientEnlistment.cs

示例11: Prepare

        public void Prepare(PreparingEnlistment preparingEnlistment)
        {
            lock (this.syncObject)
            {
                this.netTxState = TxState.Pending;

                try
                {
                    Tracer.Debug("Prepare notification received for TX id: " + this.transactionId);

                    BeforeEnd();

                    // 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;

                    this.connection.CheckConnected();
                    this.connection.SyncRequest(info);

                    // Prepare the Transaction for commit.
                    info.Type = (int) TransactionType.Prepare;
                    IntegerResponse response = (IntegerResponse) this.connection.SyncRequest(info);
                    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 prepared
                        // but clear the current state data so we appear done to the commit method.
                        preparingEnlistment.Prepared();

                        // 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.OnException(ex);
                    }
                    catch (Exception error)
                    {
                        Tracer.Error(error.ToString());
                    }

                    this.currentEnlistment = null;
                    this.transactionId = null;
                    this.netTxState = TxState.None;
                    this.dtcControlEvent.Set();
                }
            }
        }
开发者ID:Redi0,项目名称:meijing-ui,代码行数:81,代码来源:TransactionContext.cs

示例12: Prepare

			public void Prepare(PreparingEnlistment preparingEnlistment)
			{
				byte[] recoveryInformation = preparingEnlistment.RecoveryInformation();
				database.PutStatic("transactions/recoveryInformation/" + txId, null, new MemoryStream(recoveryInformation), new RavenJObject());
				preparingEnlistment.Prepared();
			}
开发者ID:pjboudrx,项目名称:ravendb,代码行数:6,代码来源:PendingTransactionRecovery.cs


注:本文中的System.Transactions.PreparingEnlistment.RecoveryInformation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。