public LifecycledComponentsReleasePolicy(ITrackedComponentsDiagnostic trackedComponentsDiagnostic) { this.trackedComponentsDiagnostic = trackedComponentsDiagnostic; if (trackedComponentsDiagnostic != null) { trackedComponentsDiagnostic.TrackedInstancesRequested += trackedComponentsDiagnostic_TrackedInstancesRequested; } }
public LifecycledComponentsReleasePolicy(ITrackedComponentsDiagnostic trackedComponentsDiagnostic, IPerformanceCounter countOfTrackedInstances) { this.trackedComponentsDiagnostic = trackedComponentsDiagnostic; this.countOfTrackedInstances = countOfTrackedInstances; if (trackedComponentsDiagnostic != null) { trackedComponentsDiagnostic.TrackedInstancesRequested += trackedComponentsDiagnostic_TrackedInstancesRequested; } }
public LifecycledComponentsReleasePolicy(ITrackedComponentsDiagnostic trackedComponentsDiagnostic, ITrackedComponentsPerformanceCounter trackedComponentsPerformanceCounter) { this.trackedComponentsDiagnostic = trackedComponentsDiagnostic; perfCounter = trackedComponentsPerformanceCounter ?? NullPerformanceCounter.Instance; if (trackedComponentsDiagnostic != null) { trackedComponentsDiagnostic.TrackedInstancesRequested += trackedComponentsDiagnostic_TrackedInstancesRequested; } }
/// <summary> /// Creates new policy which publishes its tracking components count to <paramref /// name = "trackedComponentsPerformanceCounter" /> and exposes diagnostics into <paramref /// name = "trackedComponentsDiagnostic" />. /// </summary> /// <param name = "trackedComponentsDiagnostic"></param> /// <param name = "trackedComponentsPerformanceCounter"></param> public LifecycledComponentsReleasePolicy(ITrackedComponentsDiagnostic trackedComponentsDiagnostic, ITrackedComponentsPerformanceCounter trackedComponentsPerformanceCounter) { this.trackedComponentsDiagnostic = trackedComponentsDiagnostic; perfCounter = trackedComponentsPerformanceCounter ?? NullPerformanceCounter.Instance; if (trackedComponentsDiagnostic != null) { trackedComponentsDiagnostic.TrackedInstancesRequested += trackedComponentsDiagnostic_TrackedInstancesRequested; } }
public void Dispose() { using (@lock.ForWriting()) { if (trackedComponentsDiagnostic != null) { trackedComponentsDiagnostic.TrackedInstancesRequested -= trackedComponentsDiagnostic_TrackedInstancesRequested; trackedComponentsDiagnostic = null; } var burdens = instance2Burden.ToArray(); instance2Burden.Clear(); // NOTE: This is relying on a undocumented behavior that order of items when enumerating Dictionary<> will be oldest --> latest foreach (var burden in burdens.Reverse()) { burden.Value.Release(); } } }
public void Dispose() { KeyValuePair <object, Burden>[] burdens; using (@lock.ForWriting()) { if (trackedComponentsDiagnostic != null) { trackedComponentsDiagnostic.TrackedInstancesRequested -= trackedComponentsDiagnostic_TrackedInstancesRequested; trackedComponentsDiagnostic = null; } burdens = instance2Burden.ToArray(); instance2Burden.Clear(); } // NOTE: This is relying on a undocumented behavior that order of items when enumerating Dictionary<> will be oldest --> latest foreach (var burden in burdens.Reverse()) { burden.Value.Released -= OnInstanceReleased; perfCounter.DecrementTrackedInstancesCount(); burden.Value.Release(); } }
public UnmanagedReleasePolicy(ITrackedComponentsDiagnostic trackedComponentsDiagnostic, ITrackedComponentsPerformanceCounter trackedComponentsPerformanceCounter) : base(trackedComponentsDiagnostic, trackedComponentsPerformanceCounter) { }
public LifecycledComponentsReleasePolicy(ITrackedComponentsDiagnostic trackedComponentsDiagnostic, ITrackedComponentsPerformanceCounter trackedComponentsPerformanceCounter) : base(trackedComponentsDiagnostic, trackedComponentsPerformanceCounter) { }
public void Dispose() { KeyValuePair<object, Burden>[] burdens; using (@lock.ForWriting()) { if (trackedComponentsDiagnostic != null) { trackedComponentsDiagnostic.TrackedInstancesRequested -= trackedComponentsDiagnostic_TrackedInstancesRequested; trackedComponentsDiagnostic = null; } burdens = instance2Burden.ToArray(); instance2Burden.Clear(); } // NOTE: This is relying on a undocumented behavior that order of items when enumerating Dictionary<> will be oldest --> latest foreach (var burden in burdens.Reverse()) { burden.Value.Released -= OnInstanceReleased; perfCounter.DecrementTrackedInstancesCount(); burden.Value.Release(); } }
public LifecycledComponentsReleasePolicy(ITrackedComponentsDiagnostic trackedComponentsDiagnostic) : this(trackedComponentsDiagnostic, NullPerformanceCounter.Instance) { }
/// <summary></summary> public TrulyTransientReleasePolicy(ITrackedComponentsDiagnostic trackedComponentsDiagnostic, ITrackedComponentsPerformanceCounter trackedComponentsPerformanceCounter) : base(trackedComponentsDiagnostic, trackedComponentsPerformanceCounter) { }