forked from Orckestra/C1-CMS-Foundation
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGlobalInitializerFacade.cs
838 lines (638 loc) · 28.4 KB
/
GlobalInitializerFacade.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Web;
using System.Web.Hosting;
using Composite.C1Console.Events;
using Composite.C1Console.Security;
using Composite.C1Console.Workflow;
using Composite.Core;
using Composite.Core.Collections.Generic;
using Composite.Core.Configuration;
using Composite.Core.Extensions;
using Composite.Core.IO;
using Composite.Core.Instrumentation;
using Composite.Core.Logging;
using Composite.Core.PackageSystem;
using Composite.Core.Routing;
using Composite.Core.Threading;
using Composite.Core.Types;
using Composite.Data.Foundation;
using Composite.Data.ProcessControlled;
using Composite.Functions.Foundation;
using Composite.Data.Foundation.PluginFacades;
using Composite.Plugins.Data.DataProviders.MSSqlServerDataProvider.Sql;
namespace Composite
{
/// <summary>
/// </summary>
/// <exclude />
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class GlobalInitializerFacade
{
private static readonly string LogTitle = "RGB(194, 252, 131)" + nameof(GlobalInitializerFacade);
private static readonly string LogTitleNormal = nameof(GlobalInitializerFacade);
private static bool _coreInitialized;
private static bool _initializing;
private static bool _typesAutoUpdated;
private static bool _unhandledExceptionLoggingInitialized;
private static bool _preInitHandlersRunning;
private static Exception _exceptionThrownDuringInitialization;
private static DateTime _exceptionThrownDuringInitializationTimeStamp;
private static int _fatalErrorFlushCount;
private static readonly ReaderWriterLock _readerWriterLock = new ReaderWriterLock();
private static Thread _hookingFacadeThread; // This is used to wait on the the thread if a reinitialize is issued
private static Exception _hookingFacadeException; // This will hold the exception from the before the reinitialize was issued
private static readonly ThreadLockingInformation _threadLocking = new ThreadLockingInformation();
/// <exclude />
[Obsolete("Not used")]
public static bool DynamicTypesGenerated => false;
/// <exclude />
public static bool SystemCoreInitializing => _initializing;
/// <exclude />
public static bool SystemCoreInitialized => _coreInitialized;
/// <summary>
/// This is true during a total flush of the system (re-initialize).
/// </summary>
public static bool IsReinitializingTheSystem { get; private set; }
static GlobalInitializerFacade()
{
GlobalEventSystemFacade.SubscribeToFlushEvent(OnFlushEvent);
}
/// <summary>
/// This method will initialize the system (if it has not been initialized).
/// </summary>
public static void EnsureSystemIsInitialized()
{
InitializeTheSystem();
}
/// <summary>
/// This method will initialize the system (if it has not been initialized).
/// </summary>
public static void InitializeTheSystem()
{
Verify.That(!_preInitHandlersRunning, "DataFacade related methods should not be called in OnBeforeInitialize() method of a startup handler. Please move the code to OnInitialized() instead.");
if (_exceptionThrownDuringInitialization != null)
{
TimeSpan timeSpan = DateTime.Now - _exceptionThrownDuringInitializationTimeStamp;
if (timeSpan < TimeSpan.FromMinutes(5.0))
{
Log.LogCritical(LogTitleNormal, $"Exception recorded: {timeSpan} ago");
throw new Exception("Failed to initialize the system", _exceptionThrownDuringInitialization);
}
_exceptionThrownDuringInitialization = null;
}
if (!_initializing && !_coreInitialized)
{
using (CoreLockScope)
{
if (!_initializing && !_coreInitialized)
{
try
{
_initializing = true;
if (!SystemSetupFacade.IsSystemFirstTimeInitialized && RuntimeInformation.IsDebugBuild)
{
Log.LogWarning(LogTitleNormal, new InvalidOperationException("System is initializing, yet missing first time initialization"));
}
using (ThreadDataManager.EnsureInitialize())
{
DoInitialize();
}
GC.Collect(); // Collecting generation 2 after initialization
_fatalErrorFlushCount = 0;
}
catch (Exception ex)
{
_exceptionThrownDuringInitialization = ex;
_exceptionThrownDuringInitializationTimeStamp = DateTime.Now;
var shutdownReason = HostingEnvironment.ShutdownReason;
if (shutdownReason != ApplicationShutdownReason.None)
{
Log.LogCritical(LogTitleNormal, "Shutdown reason: " + HostingEnvironment.ShutdownReason);
}
Log.LogCritical(LogTitleNormal, ex);
throw;
}
finally
{
_coreInitialized = true;
_initializing = false;
}
}
EnabledUnhandledExceptionsLogging();
}
}
}
private static void EnabledUnhandledExceptionsLogging()
{
if (_unhandledExceptionLoggingInitialized) return;
AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
{
var ex = (Exception)args.ExceptionObject;
Log.LogCritical("Unhandled exception", ex);
LogManager.Flush();
};
_unhandledExceptionLoggingInitialized = true;
}
private static void DoInitialize()
{
int startTime = Environment.TickCount;
Guid installationId = InstallationInformationFacade.InstallationId;
Log.LogVerbose(LogTitle, "Initializing the system core - installation id = " + installationId);
using (new LogExecutionTime(LogTitle, "Initialization of the static data types"))
{
DataProviderRegistry.InitializeDataTypes();
}
using (new LogExecutionTime(LogTitle, "Auto update of static data types"))
{
bool typesUpdated = AutoUpdateDataTypes();
if (typesUpdated)
{
using (new LogExecutionTime(LogTitle, "Reinitialization of the static data types"))
{
SqlTableInformationStore.Flush();
DataProviderRegistry.Flush();
DataProviderPluginFacade.Flush();
DataProviderRegistry.InitializeDataTypes();
}
CodeGenerationManager.GenerateCompositeGeneratedAssembly(true);
}
}
using (new LogExecutionTime(LogTitle, "Ensure data stores"))
{
bool dataStoresCreated = DataStoreExistenceVerifier.EnsureDataStores();
if (dataStoresCreated)
{
Log.LogVerbose(LogTitle, "Initialization of the system was halted, performing a flush");
_initializing = false;
GlobalEventSystemFacade.FlushTheSystem();
return;
}
}
using (new LogExecutionTime(LogTitle, "Initializing data process controllers"))
{
ProcessControllerFacade.Initialize_PostDataTypes();
}
using (new LogExecutionTime(LogTitle, "Initializing data type references"))
{
DataReferenceRegistry.Initialize_PostDataTypes();
}
using (new LogExecutionTime(LogTitle, "Initializing data type associations"))
{
DataAssociationRegistry.Initialize_PostDataTypes();
}
using (new LogExecutionTime(LogTitle, "Initializing internal urls"))
{
InternalUrls.Initialize_PostDataTypes();
}
using (new LogExecutionTime(LogTitle, "Initializing functions"))
{
MetaFunctionProviderRegistry.Initialize_PostDataTypes();
}
Log.LogVerbose(LogTitle, "Starting initialization of administrative secondaries");
if (SystemSetupFacade.IsSystemFirstTimeInitialized && !SystemSetupFacade.SetupIsRunning && HostingEnvironment.IsHosted)
{
using (new LogExecutionTime(LogTitle, "Initializing workflow runtime"))
{
WorkflowFacade.EnsureInitialization();
}
}
using (new LogExecutionTime(LogTitle, "Auto installing packages"))
{
DoAutoInstallPackages();
}
int executionTime = Environment.TickCount - startTime;
Log.LogVerbose(LogTitle, $"Done initializing of the system core. ({executionTime} ms)");
}
private static bool AutoUpdateDataTypes()
{
if (!GlobalSettingsFacade.EnableDataTypesAutoUpdate)
{
return false;
}
if (_typesAutoUpdated)
{
// This is here to catch update -> failed -> update -> failed -> ... loop
DataInterfaceAutoUpdater.TestEnsureUpdateAllInterfaces();
return false;
}
bool flushTheSystem = DataInterfaceAutoUpdater.EnsureUpdateAllInterfaces();
_typesAutoUpdated = true;
return flushTheSystem;
}
/// <exclude />
public static void ReinitializeTheSystem(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate)
{
ReinitializeTheSystem(runInWriterLockScopeDelegate, false);
}
internal static void ReinitializeTheSystem(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate, bool initializeHooksInTheSameThread)
{
if (_hookingFacadeThread != null)
{
_hookingFacadeThread.Join(TimeSpan.FromSeconds(30));
if (_hookingFacadeException != null)
{
throw new InvalidOperationException("The initialization of the HookingFacade failed before this reinitialization was issued", _hookingFacadeException);
}
}
using (CoreLockScope)
{
IsReinitializingTheSystem = true;
runInWriterLockScopeDelegate();
_coreInitialized = false;
_initializing = false;
_exceptionThrownDuringInitialization = null;
Verify.That(_fatalErrorFlushCount <= 1, "Failed to reload the system. See the log for the details.");
InitializeTheSystem();
IsReinitializingTheSystem = false;
}
}
private static void EnsureHookingFacade(object timeSpanToDelayStart)
{
// NOTE: Condition is made for unit-testing
if (HostingEnvironment.IsHosted)
{
var kvp = (KeyValuePair<TimeSpan, StackTrace>)timeSpanToDelayStart;
_hookingFacadeException = null;
Thread.Sleep(kvp.Key);
try
{
using (CoreIsInitializedScope)
{
using (ThreadDataManager.EnsureInitialize())
{
HookingFacade.EnsureInitialization();
}
}
}
catch (Exception ex)
{
_hookingFacadeException = ex;
}
}
_hookingFacadeThread = null;
}
/// <exclude />
public static void WaitUntilAllIsInitialized()
{
using (CoreIsInitializedScope)
{
_hookingFacadeThread?.Join();
}
}
/// <exclude />
public static void FatalResetTheSystem()
{
Log.LogWarning(LogTitle, "Unhandled error occurred, reinitializing the system!");
ReinitializeTheSystem(delegate { _fatalErrorFlushCount++; GlobalEventSystemFacade.FlushTheSystem(); });
}
/// <exclude />
public static void UninitializeTheSystem(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate)
{
using (CoreLockScope)
{
using (new LogExecutionTime(LogTitle, "Uninitializing the system"))
{
runInWriterLockScopeDelegate();
}
_coreInitialized = false;
_initializing = false;
_exceptionThrownDuringInitialization = null;
}
}
internal static IDisposable GetPreInitHandlersScope()
{
return new PreInitHandlersScope();
}
private class PreInitHandlersScope : IDisposable
{
public PreInitHandlersScope()
{
_preInitHandlersRunning = true;
}
public void Dispose()
{
_preInitHandlersRunning = false;
#if LeakCheck
GC.SuppressFinalize(this);
#endif
}
#if LeakCheck
private string stack = Environment.StackTrace;
/// <exclude />
~PreInitHandlersScope()
{
Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);
}
#endif
}
#region Package installation
private class AutoInstallPackageInfo
{
public bool ToBeDeleted { get; set; }
public string FilePath { get; set; }
}
private static void DoAutoInstallPackages()
{
if (IsReinitializingTheSystem) return;
try
{
// This is not so good, unittests run and normal runs should have same semantic behavior.
// But if this is not here, some unittests will start failing. /MRJ
if (RuntimeInformation.IsUnittest) return;
var zipFiles = new List<AutoInstallPackageInfo>();
string directory = PathUtil.Resolve(GlobalSettingsFacade.AutoPackageInstallDirectory);
if (C1Directory.Exists(directory))
{
Log.LogVerbose(LogTitle, $"Installing packages from: {directory}");
zipFiles.AddRange(C1Directory.GetFiles(directory, "*.zip")
.OrderBy(f => f)
.Select(f => new AutoInstallPackageInfo { FilePath = f, ToBeDeleted = true }));
}
else
{
Log.LogVerbose(LogTitle, $"Auto install directory not found: {directory}");
}
if (RuntimeInformation.IsDebugBuild)
{
string workflowTestDir = Path.Combine(PathUtil.Resolve(GlobalSettingsFacade.AutoPackageInstallDirectory), "WorkflowTesting");
if (C1Directory.Exists(workflowTestDir))
{
Log.LogVerbose(LogTitle, $"Installing packages from: {workflowTestDir}");
zipFiles.AddRange(C1Directory.GetFiles(workflowTestDir, "*.zip")
.OrderBy(f => f)
.Select(f => new AutoInstallPackageInfo { FilePath = f, ToBeDeleted = false }));
}
}
foreach (var zipFile in zipFiles)
{
try
{
using (Stream zipFileStream = C1File.OpenRead(zipFile.FilePath))
{
Log.LogVerbose(LogTitle, $"Installing package: {zipFile.FilePath}");
PackageManagerInstallProcess packageManagerInstallProcess = PackageManager.Install(zipFileStream, true);
if (packageManagerInstallProcess.PreInstallValidationResult.Count > 0)
{
Log.LogError(LogTitleNormal, "Package installation failed! (Pre install validation error)");
LogErrors(packageManagerInstallProcess.PreInstallValidationResult);
continue;
}
List<PackageFragmentValidationResult> validationResults = packageManagerInstallProcess.Validate();
if (validationResults.Count > 0)
{
Log.LogError(LogTitleNormal, "Package installation failed! (Validation error)");
LogErrors(validationResults);
continue;
}
List<PackageFragmentValidationResult> installResult = packageManagerInstallProcess.Install();
if (installResult.Count > 0)
{
Log.LogError(LogTitleNormal, "Package installation failed! (Installation error)");
LogErrors(installResult);
continue;
}
}
}
catch (Exception ex)
{
Log.LogWarning(LogTitleNormal, ex);
}
if (zipFile.ToBeDeleted)
{
FileUtils.Delete(zipFile.FilePath);
}
}
}
catch (Exception ex)
{
Log.LogError(LogTitleNormal, ex);
}
}
#endregion
#region Utilities
/// <exclude />
public static void ValidateIsOnlyCalledFromGlobalInitializerFacade(StackTrace stackTrace)
{
MethodBase methodInfo = stackTrace.GetFrame(1).GetMethod();
if (methodInfo.DeclaringType != typeof(GlobalInitializerFacade))
{
throw new SystemException($"The method {methodInfo} may only be called by the {typeof(GlobalInitializerFacade)}");
}
}
private static void LogErrors(IEnumerable<PackageFragmentValidationResult> packageErrors)
{
foreach (PackageFragmentValidationResult packageFragmentValidationResult in packageErrors)
{
Log.LogError(LogTitleNormal, packageFragmentValidationResult.Message);
if (packageFragmentValidationResult.Exception != null)
{
Log.LogError(LogTitleNormal, "With following exception:");
Log.LogError(LogTitleNormal, packageFragmentValidationResult.Exception);
}
}
}
private static void OnFlushEvent(FlushEventArgs args)
{
using (CoreLockScope)
{
_coreInitialized = false;
}
}
#endregion
#region Locking
/// <exclude />
public delegate void RunInWriterLockScopeDelegate();
/// <exclude />
public static void RunInWriterLockScope(RunInWriterLockScopeDelegate runInWriterLockScopeDelegate)
{
using (CoreLockScope)
{
runInWriterLockScopeDelegate();
}
}
/// <summary>
/// Locks the initialization token until disposed. Use this in a using {} statement.
/// </summary>
internal static IDisposable CoreLockScope
{
get
{
var stackTrace = new StackTrace();
var method = stackTrace.GetFrame(1).GetMethod();
return new LockerToken(true, $"{method.DeclaringType.Name}.{method.Name}");
}
}
/// <summary>
/// Using this in a using-statement will ensure that the code are
/// executed AFTER the system has been initialized.
/// </summary>
public static IDisposable CoreIsInitializedScope
{
get
{
// This line ensures that the system is always initialized.
// Even if the InitializeTheSystem method is NOT called during
// application startup.
InitializeTheSystem();
return new LockerToken();
}
}
/// <summary>
/// Using this in a using-statement will ensure that the code is
/// executed AFTER any existing locks has been released.
/// </summary>
public static IDisposable CoreNotLockedScope => new LockerToken();
private static void AcquireReaderLock()
{
_readerWriterLock.AcquireReaderLock(GlobalSettingsFacade.DefaultReaderLockWaitTimeout);
}
private static void AcquireWriterLock()
{
int threadId = Thread.CurrentThread.ManagedThreadId;
if (_readerWriterLock.IsReaderLockHeld)
{
LockCookie lockCookie = _readerWriterLock.UpgradeToWriterLock(GlobalSettingsFacade.DefaultWriterLockWaitTimeout);
lock(_threadLocking)
{
_threadLocking.LockCookiesPerThreadId.Add(threadId, lockCookie);
}
}
else
{
_readerWriterLock.AcquireWriterLock(GlobalSettingsFacade.DefaultWriterLockWaitTimeout);
}
lock (_threadLocking)
{
if (_threadLocking.WriterLocksPerThreadId.ContainsKey(threadId))
{
_threadLocking.WriterLocksPerThreadId[threadId] = _threadLocking.WriterLocksPerThreadId[threadId] + 1;
}
else
{
_threadLocking.WriterLocksPerThreadId.Add(threadId, 1);
}
}
}
private static void ReleaseReaderLock()
{
_readerWriterLock.ReleaseReaderLock();
}
private static void ReleaseWriterLock()
{
int threadId = Thread.CurrentThread.ManagedThreadId;
if (_threadLocking.WriterLocksPerThreadId[threadId] == 1 &&
_threadLocking.LockCookiesPerThreadId.ContainsKey(threadId))
{
LockCookie lockCookie = _threadLocking.LockCookiesPerThreadId[threadId];
lock(_threadLocking)
{
_threadLocking.LockCookiesPerThreadId.Remove(threadId);
}
_readerWriterLock.DowngradeFromWriterLock(ref lockCookie);
}
else
{
_readerWriterLock.ReleaseWriterLock();
}
lock (_threadLocking)
{
_threadLocking.WriterLocksPerThreadId[threadId] = _threadLocking.WriterLocksPerThreadId[threadId] - 1;
if (_threadLocking.WriterLocksPerThreadId[threadId] == 0)
{
_threadLocking.WriterLocksPerThreadId.Remove(threadId);
}
}
}
/// <summary>
/// Encapsulates calls to [Acquire|Release][Reader|Writer]Lock(), keeps log of writer locks
/// </summary>
private sealed class LockerToken : IDisposable
{
private readonly bool _isWriterLock;
private readonly string _lockSource;
/// <summary>
/// Creates a read lock
/// </summary>
internal LockerToken()
: this(false, null)
{
}
internal LockerToken(bool writerLock, string lockSource)
{
_isWriterLock = writerLock;
_lockSource = lockSource;
if (!writerLock)
{
AcquireReaderLock();
return;
}
Verify.ArgumentCondition(!lockSource.IsNullOrEmpty(), nameof(lockSource), "Write locks must be obtained with a string identifying the source");
#region Logging the action
string methodInfo = string.Empty;
if (RuntimeInformation.IsUnittest)
{
var stackTrace = new StackTrace();
StackFrame stackFrame =
(from sf in stackTrace.AsQueryable()
where sf.GetMethod().DeclaringType.Assembly.FullName.Contains("Composite.Test")
select sf).FirstOrDefault();
if (stackFrame != null)
{
methodInfo = ", Method:" + stackFrame.GetMethod().Name;
}
}
Log.LogVerbose(LogTitle, $"Writer Lock Acquired (Managed Thread ID: {Thread.CurrentThread.ManagedThreadId}, Source: {lockSource}{methodInfo})");
#endregion Logging the action
AcquireWriterLock();
}
public void Dispose()
{
#if LeakCheck
GC.SuppressFinalize(this);
#endif
if (!_isWriterLock)
{
ReleaseReaderLock();
return;
}
#region Logging the action
string methodInfo = string.Empty;
if (RuntimeInformation.IsUnittest)
{
var stackTrace = new StackTrace();
StackFrame stackFrame =
(from sf in stackTrace.AsQueryable()
where sf.GetMethod().DeclaringType.Assembly.FullName.Contains("Composite.Test")
select sf).FirstOrDefault();
if (stackFrame != null)
{
methodInfo = ", Method: " + stackFrame.GetMethod().Name;
}
}
Log.LogVerbose(LogTitle, $"Writer Lock Releasing (Managed Thread ID: {Thread.CurrentThread.ManagedThreadId}, Source: {_lockSource}{methodInfo})");
#endregion
ReleaseWriterLock();
}
#if LeakCheck
private string stack = Environment.StackTrace;
/// <exclude />
~LockerToken()
{
Composite.Core.Instrumentation.DisposableResourceTracer.RegisterFinalizerExecution(stack);
}
#endif
}
#endregion
private sealed class ThreadLockingInformation
{
public readonly Hashtable<int, int> WriterLocksPerThreadId = new Hashtable<int, int>();
public readonly Hashtable<int, LockCookie> LockCookiesPerThreadId = new Hashtable<int, LockCookie>();
}
}
}