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

◆ Reenlist()

static Enlistment System.Transactions.TransactionManager.Reenlist ( Guid resourceManagerIdentifier,
byte[] recoveryInformation,
IEnlistmentNotification enlistmentNotification )
inlinestatic

Definition at line 208 of file TransactionManager.cs.

209 {
210 if (resourceManagerIdentifier == Guid.Empty)
211 {
212 throw new ArgumentException(System.SR.BadResourceManagerId, "resourceManagerIdentifier");
213 }
214 if (recoveryInformation == null)
215 {
216 throw new ArgumentNullException("recoveryInformation");
217 }
218 if (enlistmentNotification == null)
219 {
220 throw new ArgumentNullException("enlistmentNotification");
221 }
222 TransactionsEtwProvider log = TransactionsEtwProvider.Log;
223 if (log.IsEnabled())
224 {
225 log.MethodEnter(TraceSourceType.TraceSourceBase, "TransactionManager.Reenlist");
226 log.TransactionManagerReenlist(resourceManagerIdentifier);
227 }
228 MemoryStream memoryStream = new MemoryStream(recoveryInformation);
229 int num = 0;
230 string nodeName = null;
231 byte[] resourceManagerRecoveryInformation = null;
232 try
233 {
234 BinaryReader binaryReader = new BinaryReader(memoryStream);
235 num = binaryReader.ReadInt32();
236 if (num != 1)
237 {
238 if (log.IsEnabled())
239 {
240 log.TransactionExceptionTrace(TraceSourceType.TraceSourceBase, TransactionExceptionType.UnrecognizedRecoveryInformation, "recoveryInformation", string.Empty);
241 }
242 throw new ArgumentException(System.SR.UnrecognizedRecoveryInformation, "recoveryInformation");
243 }
244 nodeName = binaryReader.ReadString();
245 resourceManagerRecoveryInformation = binaryReader.ReadBytes(recoveryInformation.Length - checked((int)memoryStream.Position));
246 }
247 catch (EndOfStreamException ex)
248 {
249 if (log.IsEnabled())
250 {
251 log.TransactionExceptionTrace(TraceSourceType.TraceSourceBase, TransactionExceptionType.UnrecognizedRecoveryInformation, "recoveryInformation", ex.ToString());
252 }
253 throw new ArgumentException(System.SR.UnrecognizedRecoveryInformation, "recoveryInformation", ex);
254 }
255 catch (FormatException ex2)
256 {
257 if (log.IsEnabled())
258 {
259 log.TransactionExceptionTrace(TraceSourceType.TraceSourceBase, TransactionExceptionType.UnrecognizedRecoveryInformation, "recoveryInformation", ex2.ToString());
260 }
261 throw new ArgumentException(System.SR.UnrecognizedRecoveryInformation, "recoveryInformation", ex2);
262 }
263 finally
264 {
265 memoryStream.Dispose();
266 }
268 object syncRoot = new object();
269 Enlistment enlistment = new Enlistment(enlistmentNotification, syncRoot);
270 EnlistmentState.EnlistmentStatePromoted.EnterState(enlistment.InternalEnlistment);
271 enlistment.InternalEnlistment.PromotedEnlistment = distributedTransactionManager.ReenlistTransaction(resourceManagerIdentifier, resourceManagerRecoveryInformation, (RecoveringInternalEnlistment)enlistment.InternalEnlistment);
272 if (log.IsEnabled())
273 {
274 log.MethodExit(TraceSourceType.TraceSourceBase, "TransactionManager.Reenlist");
275 }
276 return enlistment;
277 }
override string ToString()
Definition Exception.cs:384
virtual string ReadString()
virtual int ReadInt32()
virtual byte[] ReadBytes(int count)
override long Position
override void Dispose(bool disposing)
static string BadResourceManagerId
Definition SR.cs:18
static string UnrecognizedRecoveryInformation
Definition SR.cs:76
Definition SR.cs:7
static DistributedTransactionManager CheckTransactionManager(string nodeName)
static DistributedTransactionManager distributedTransactionManager

References System.SR.BadResourceManagerId, System.Transactions.TransactionManager.CheckTransactionManager(), System.IO.MemoryStream.Dispose(), System.Transactions.TransactionManager.distributedTransactionManager, System.Guid.Empty, System.Transactions.EnlistmentState.EnlistmentStatePromoted, System.Transactions.Enlistment.InternalEnlistment, System.Diagnostics.Tracing.EventSource.IsEnabled(), System.Transactions.TransactionsEtwProvider.Log, System.Transactions.TransactionsEtwProvider.MethodEnter(), System.Transactions.TransactionsEtwProvider.MethodExit(), System.IO.MemoryStream.Position, System.IO.BinaryReader.ReadBytes(), System.IO.BinaryReader.ReadInt32(), System.IO.BinaryReader.ReadString(), System.Exception.ToString(), System.Transactions.TransactionsEtwProvider.TransactionExceptionTrace(), System.Transactions.TransactionsEtwProvider.TransactionManagerReenlist(), and System.SR.UnrecognizedRecoveryInformation.