internal OletxTransactionManager(string nodeName) { lock (ClassSyncObject) { if (proxyShimFactory == null) { if (System.Transactions.Oletx.NativeMethods.GetNotificationFactory(ShimWaitHandle.SafeWaitHandle, out proxyShimFactory) != 0) { throw TransactionException.Create(System.Transactions.SR.GetString("TraceSourceOletx"), System.Transactions.SR.GetString("UnableToGetNotificationShimFactory"), null); } ThreadPool.UnsafeRegisterWaitForSingleObject(ShimWaitHandle, new WaitOrTimerCallback(OletxTransactionManager.ShimNotificationCallback), null, -1, false); } } this.dtcTransactionManagerLock = new ReaderWriterLock(); this.nodeNameField = nodeName; if ((this.nodeNameField != null) && (this.nodeNameField.Length == 0)) { this.nodeNameField = null; } if (DiagnosticTrace.Verbose) { DistributedTransactionManagerCreatedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), base.GetType(), this.nodeNameField); } this.configuredTransactionOptions.IsolationLevel = this.isolationLevelProperty = TransactionManager.DefaultIsolationLevel; this.configuredTransactionOptions.Timeout = this.timeoutProperty = TransactionManager.DefaultTimeout; this.internalResourceManager = new OletxInternalResourceManager(this); this.dtcTransactionManagerLock.AcquireWriterLock(-1); try { this.dtcTransactionManager = new System.Transactions.Oletx.DtcTransactionManager(this.nodeNameField, this); } finally { this.dtcTransactionManagerLock.ReleaseWriterLock(); } if (resourceManagerHashTable == null) { resourceManagerHashTable = new Hashtable(2); resourceManagerHashTableLock = new ReaderWriterLock(); } }
internal OletxTransactionManager( string nodeName ) { lock ( ClassSyncObject ) { // If we have not already initialized the shim factory and started the notification // thread, do so now. if (null == OletxTransactionManager.proxyShimFactory) { Int32 error = NativeMethods.GetNotificationFactory( OletxTransactionManager.ShimWaitHandle.SafeWaitHandle, out OletxTransactionManager.proxyShimFactory ); if (0 != error) { throw TransactionException.Create(SR.GetString(SR.TraceSourceOletx), SR.GetString(SR.UnableToGetNotificationShimFactory), null); } ThreadPool.UnsafeRegisterWaitForSingleObject( OletxTransactionManager.ShimWaitHandle, new WaitOrTimerCallback(OletxTransactionManager.ShimNotificationCallback), null, -1, false ); } } this.dtcTransactionManagerLock = new ReaderWriterLock(); this.nodeNameField = nodeName; // The DTC proxy doesn't like an empty string for node name on 64-bit platforms when // running as WOW64. It treats any non-null node name as a "remote" node and turns off // the WOW64 bit, causing problems when reading the registry. So if we got on empty // string for the node name, just treat it as null. if ((null != this.nodeNameField) && (0 == this.nodeNameField.Length)) { this.nodeNameField = null; } if (DiagnosticTrace.Verbose) { DistributedTransactionManagerCreatedTraceRecord.Trace(SR.GetString(SR.TraceSourceOletx), this.GetType(), this.nodeNameField ); } // Initialize the properties from config. configuredTransactionOptions.IsolationLevel = isolationLevelProperty = TransactionManager.DefaultIsolationLevel; configuredTransactionOptions.Timeout = timeoutProperty = TransactionManager.DefaultTimeout; this.internalResourceManager = new OletxInternalResourceManager(this); dtcTransactionManagerLock.AcquireWriterLock(-1); try { this.dtcTransactionManager = new DtcTransactionManager(this.nodeNameField, this); } finally { dtcTransactionManagerLock.ReleaseWriterLock(); } if (resourceManagerHashTable == null) { resourceManagerHashTable = new Hashtable(2); resourceManagerHashTableLock = new System.Threading.ReaderWriterLock(); } }