internal override void EnterState(InternalTransaction tx)
{
// Set the transaction state
CommonEnterState(tx);
// Mark the committable transaction as complete.
tx._committableTransaction._complete = true;
// If at this point there are phase1 dependent clones abort the transaction
if (tx._phase1Volatiles._dependentClones != 0)
{
TransactionStateAborted.EnterState(tx);
return;
}
if (tx._phase1Volatiles._volatileEnlistmentCount == 1 && tx._durableEnlistment == null
&& tx._phase1Volatiles._volatileEnlistments[0].SinglePhaseNotification != null)
{
// This is really a case of SPC for volatiles
TransactionStateVolatileSPC.EnterState(tx);
}
else if (tx._phase1Volatiles._volatileEnlistmentCount > 0)
{
// Broadcast prepare to the phase 0 enlistments
for (int i = 0; i < tx._phase1Volatiles._volatileEnlistmentCount; i++)
{
tx._phase1Volatiles._volatileEnlistments[i]._twoPhaseState.ChangeStatePreparing(tx._phase1Volatiles._volatileEnlistments[i]);
if (!tx.State.ContinuePhase1Prepares())
{
break;
}
}
}
else
{
// No volatile phase 1 enlistments. Start phase durable SPC.
TransactionStateSPC.EnterState(tx);
}
}