improve CompositeMetricReader.Dispose (#2514)
This commit is contained in:
parent
6267c24978
commit
6048a66d43
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue