Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ PSPEPromote()

DistributedTransaction System.Transactions.TransactionStatePSPEOperation.PSPEPromote ( InternalTransaction tx)
inlinepackage

Definition at line 45 of file TransactionStatePSPEOperation.cs.

46 {
47 bool flag = true;
48 TransactionState state = tx.State;
50 DistributedTransaction distributedTransaction = null;
51 try
52 {
53 if (tx._attemptingPSPEPromote)
54 {
55 throw TransactionException.CreateInvalidOperationException(TraceSourceType.TraceSourceLtm, System.SR.PromotedReturnedInvalidValue, null, tx.DistributedTxId);
56 }
57 tx._attemptingPSPEPromote = true;
58 byte[] array = tx._promoter.Promote();
59 if (tx._promoterType != TransactionInterop.PromoterTypeDtc)
60 {
61 if (array == null)
62 {
63 throw TransactionException.CreateInvalidOperationException(TraceSourceType.TraceSourceLtm, System.SR.PromotedReturnedInvalidValue, null, tx.DistributedTxId);
64 }
65 tx.promotedToken = array;
66 return null;
67 }
68 if (array == null)
69 {
70 if (tx.PromotedTransaction == null)
71 {
72 throw TransactionException.CreateInvalidOperationException(TraceSourceType.TraceSourceLtm, System.SR.PromotedReturnedInvalidValue, null, tx.DistributedTxId);
73 }
74 flag = false;
75 distributedTransaction = tx.PromotedTransaction;
76 }
77 if (distributedTransaction == null)
78 {
79 try
80 {
81 distributedTransaction = TransactionInterop.GetDistributedTransactionFromTransmitterPropagationToken(array);
82 }
83 catch (ArgumentException innerException)
84 {
85 throw TransactionException.CreateInvalidOperationException(TraceSourceType.TraceSourceLtm, System.SR.PromotedReturnedInvalidValue, innerException, tx.DistributedTxId);
86 }
87 if (TransactionManager.FindPromotedTransaction(distributedTransaction.Identifier) != null)
88 {
89 distributedTransaction.Dispose();
90 throw TransactionException.CreateInvalidOperationException(TraceSourceType.TraceSourceLtm, System.SR.PromotedTransactionExists, null, tx.DistributedTxId);
91 }
92 }
93 }
94 finally
95 {
96 tx._attemptingPSPEPromote = false;
97 if (flag)
98 {
99 state.CommonEnterState(tx);
100 }
101 }
102 return distributedTransaction;
103 }
static string PromotedReturnedInvalidValue
Definition SR.cs:44
static string PromotedTransactionExists
Definition SR.cs:46
Definition SR.cs:7
void CommonEnterState(InternalTransaction tx)

References System.Transactions.InternalTransaction._attemptingPSPEPromote, System.Transactions.InternalTransaction._promoter, System.Transactions.InternalTransaction._promoterType, System.array, System.Transactions.TransactionState.CommonEnterState(), System.Transactions.TransactionException.CreateInvalidOperationException(), System.Transactions.Distributed.DistributedTransaction.Dispose(), System.Transactions.InternalTransaction.DistributedTxId, System.Transactions.TransactionManager.FindPromotedTransaction(), System.Transactions.TransactionInterop.GetDistributedTransactionFromTransmitterPropagationToken(), System.Transactions.Distributed.DistributedTransaction.Identifier, System.Transactions.ITransactionPromoter.Promote(), System.SR.PromotedReturnedInvalidValue, System.Transactions.InternalTransaction.PromotedTransaction, System.SR.PromotedTransactionExists, System.Transactions.TransactionInterop.PromoterTypeDtc, System.state, and System.Transactions.InternalTransaction.State.