通过


TransactionManager.Reenlist(Guid, Byte[], IEnlistmentNotification) 方法

定义

重新登记事务中的持久参与者。

public:
 static System::Transactions::Enlistment ^ Reenlist(Guid resourceManagerIdentifier, cli::array <System::Byte> ^ recoveryInformation, System::Transactions::IEnlistmentNotification ^ enlistmentNotification);
public static System.Transactions.Enlistment Reenlist(Guid resourceManagerIdentifier, byte[] recoveryInformation, System.Transactions.IEnlistmentNotification enlistmentNotification);
static member Reenlist : Guid * byte[] * System.Transactions.IEnlistmentNotification -> System.Transactions.Enlistment
Public Shared Function Reenlist (resourceManagerIdentifier As Guid, recoveryInformation As Byte(), enlistmentNotification As IEnlistmentNotification) As Enlistment

参数

resourceManagerIdentifier
Guid

唯一标识资源管理器的一个 Guid

recoveryInformation
Byte[]

包含恢复信息的其他信息。

enlistmentNotification
IEnlistmentNotification

实现 IEnlistmentNotification 接收通知的资源对象。

返回

描述登记的一个 Enlistment

例外

recoveryInformation 无效。

-或-

中的 recoveryInformation 事务管理器信息与配置的事务管理器不匹配。

-或-

recoveryInformation未被识别。System.Transactions

RecoveryComplete(Guid) 已为指定 resourceManagerIdentifier项调用 。 重新登记被拒绝。

resourceManagerIdentifier 指定恢复信息的内容 recoveryInformation不匹配。

注解

重要

使用不受信任的数据调用此方法是一种安全风险。 仅使用受信任的数据调用此方法。 有关详细信息,请参阅验证所有输入

资源管理器通过在资源失败之后重新登记事务参与者来促进事务中的持久登记的解决。

参数 resourceManagerIdentifier 用于在发生资源故障时一致地标记事务的参与者。 调用Reenlist该方法时,资源管理器必须提供与最初在登记期间调用EnlistDurable该方法时使用的相同resourceManagerIdentifier,或引发方法TransactionException

使用此方法重新登记参与者时,将相应地调用与事务结果(即,CommitRollbackInDoubt)对应的第 2 阶段方法IEnlistmentNotification

成功重新登记参与者后,应调用以 RecoveryComplete 完成恢复。

仅当资源管理器从失败重启时,才应调用此方法。 此外,应该仅重新登记在两阶段提交的初始准备阶段中由资源管理器记录的未解决事务。 在无效时间调用此方法的任何尝试都会产生错误的结果。

如果事务管理器失败,并且资源管理器仅在调用 Two-Phase 提交协议第 1 阶段中的登记方法后 Prepared 执行恢复,则资源管理器可能会收到 InDoubtRollback 回调。

适用于