internal override void EnterState(InternalEnlistment enlistment)
{
bool spcCommitted = false;
// Set the enlistment state
enlistment.State = this;
Monitor.Exit(enlistment.Transaction);
try
{
TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
if (etwLog.IsEnabled())
{
etwLog.EnlistmentStatus(enlistment, NotificationCall.SinglePhaseCommit);
}
// Send the Commit notification to the enlistment
if (enlistment.SinglePhaseNotification != null)
{
enlistment.SinglePhaseNotification.SinglePhaseCommit(enlistment.SinglePhaseEnlistment);
}
else
{
enlistment.PromotableSinglePhaseNotification.SinglePhaseCommit(enlistment.SinglePhaseEnlistment);
}
spcCommitted = true;
}
finally
{
if (!spcCommitted)
{
enlistment.SinglePhaseEnlistment.InDoubt();
}
Monitor.Enter(enlistment.Transaction);
}
}