improve CompositeMetricReader.Dispose (#2514)

This commit is contained in:
Reiley Yang 2021-10-26 07:30:38 -07:00 committed by GitHub
parent 6267c24978
commit 6048a66d43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 20 deletions

View File

@ -127,32 +127,32 @@ namespace OpenTelemetry.Metrics
protected override void Dispose(bool disposing)
{
if (this.disposed)
if (!this.disposed)
{
return;
}
if (disposing)
{
var cur = this.head;
while (cur != null)
if (disposing)
{
try
{
cur.Value?.Dispose();
}
catch (Exception)
{
// TODO: which event source do we use?
// OpenTelemetrySdkEventSource.Log.SpanProcessorException(nameof(this.Dispose), ex);
}
var cur = this.head;
cur = cur.Next;
while (cur != null)
{
try
{
cur.Value?.Dispose();
}
catch (Exception)
{
// TODO: which event source do we use?
// OpenTelemetrySdkEventSource.Log.SpanProcessorException(nameof(this.Dispose), ex);
}
cur = cur.Next;
}
}
this.disposed = true;
}
this.disposed = true;
base.Dispose(disposing);
}
public struct Enumerator