File tree 3 files changed +17
-30
lines changed
3 files changed +17
-30
lines changed Original file line number Diff line number Diff line change @@ -217,16 +217,13 @@ protected override void Dispose(bool disposing)
217
217
{
218
218
if ( disposing )
219
219
{
220
- if ( this . instrumentations != null )
220
+ foreach ( var item in this . instrumentations )
221
221
{
222
- foreach ( var item in this . instrumentations )
223
- {
224
- ( item as IDisposable ) ? . Dispose ( ) ;
225
- }
226
-
227
- this . instrumentations . Clear ( ) ;
222
+ ( item as IDisposable ) ? . Dispose ( ) ;
228
223
}
229
224
225
+ this . instrumentations . Clear ( ) ;
226
+
230
227
// Wait for up to 5 seconds grace period
231
228
this . Processor ? . Shutdown ( 5000 ) ;
232
229
this . Processor ? . Dispose ( ) ;
Original file line number Diff line number Diff line change @@ -451,16 +451,13 @@ protected override void Dispose(bool disposing)
451
451
{
452
452
if ( disposing )
453
453
{
454
- if ( this . instrumentations != null )
454
+ foreach ( var item in this . instrumentations )
455
455
{
456
- foreach ( var item in this . instrumentations )
457
- {
458
- ( item as IDisposable ) ? . Dispose ( ) ;
459
- }
460
-
461
- this . instrumentations . Clear ( ) ;
456
+ ( item as IDisposable ) ? . Dispose ( ) ;
462
457
}
463
458
459
+ this . instrumentations . Clear ( ) ;
460
+
464
461
// Wait for up to 5 seconds grace period
465
462
this . reader ? . Shutdown ( 5000 ) ;
466
463
this . reader ? . Dispose ( ) ;
Original file line number Diff line number Diff line change @@ -352,18 +352,14 @@ internal bool OnForceFlush(int timeoutMilliseconds)
352
352
internal bool OnShutdown ( int timeoutMilliseconds )
353
353
{
354
354
// TO DO Put OnShutdown logic in a task to run within the user provider timeOutMilliseconds
355
- bool ? result ;
356
- if ( this . instrumentations != null )
355
+ foreach ( var item in this . instrumentations )
357
356
{
358
- foreach ( var item in this . instrumentations )
359
- {
360
- ( item as IDisposable ) ? . Dispose ( ) ;
361
- }
362
-
363
- this . instrumentations . Clear ( ) ;
357
+ ( item as IDisposable ) ? . Dispose ( ) ;
364
358
}
365
359
366
- result = this . processor ? . Shutdown ( timeoutMilliseconds ) ;
360
+ this . instrumentations . Clear ( ) ;
361
+
362
+ bool ? result = this . processor ? . Shutdown ( timeoutMilliseconds ) ;
367
363
this . listener ? . Dispose ( ) ;
368
364
return result ?? true ;
369
365
}
@@ -374,16 +370,13 @@ protected override void Dispose(bool disposing)
374
370
{
375
371
if ( disposing )
376
372
{
377
- if ( this . instrumentations != null )
373
+ foreach ( var item in this . instrumentations )
378
374
{
379
- foreach ( var item in this . instrumentations )
380
- {
381
- ( item as IDisposable ) ? . Dispose ( ) ;
382
- }
383
-
384
- this . instrumentations . Clear ( ) ;
375
+ ( item as IDisposable ) ? . Dispose ( ) ;
385
376
}
386
377
378
+ this . instrumentations . Clear ( ) ;
379
+
387
380
( this . sampler as IDisposable ) ? . Dispose ( ) ;
388
381
389
382
// Wait for up to 5 seconds grace period
You can’t perform that action at this time.
0 commit comments