@@ -216,19 +216,22 @@ private void handleStoreAddError(ComplexEventChunk addingEventChunk, boolean isF
216
216
}
217
217
218
218
public void addEvents (ComplexEventChunk <StreamEvent > addingEventChunk , int noOfEvents ) {
219
- if (latencyTrackerInsert != null &&
220
- Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
221
- latencyTrackerInsert .markIn ();
222
- }
223
- addingEventChunk .reset ();
224
- add (addingEventChunk );
225
- if (latencyTrackerInsert != null &&
226
- Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
227
- latencyTrackerInsert .markOut ();
228
- }
229
- if (throughputTrackerInsert != null &&
230
- Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
231
- throughputTrackerInsert .eventsIn (noOfEvents );
219
+ try {
220
+ if (throughputTrackerInsert != null &&
221
+ Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
222
+ throughputTrackerInsert .eventsIn (noOfEvents );
223
+ }
224
+ if (latencyTrackerInsert != null &&
225
+ Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
226
+ latencyTrackerInsert .markIn ();
227
+ }
228
+ addingEventChunk .reset ();
229
+ add (addingEventChunk );
230
+ } finally {
231
+ if (latencyTrackerInsert != null &&
232
+ Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
233
+ latencyTrackerInsert .markOut ();
234
+ }
232
235
}
233
236
}
234
237
@@ -335,18 +338,21 @@ protected void onDeleteError(ComplexEventChunk<StateEvent> deletingEventChunk, C
335
338
336
339
public void deleteEvents (ComplexEventChunk <StateEvent > deletingEventChunk , CompiledCondition compiledCondition ,
337
340
int noOfEvents ) {
338
- if (latencyTrackerDelete != null &&
339
- Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
340
- latencyTrackerDelete .markIn ();
341
- }
342
- delete (deletingEventChunk , compiledCondition );
343
- if (latencyTrackerDelete != null &&
344
- Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
345
- latencyTrackerDelete .markOut ();
346
- }
347
- if (throughputTrackerDelete != null &&
348
- Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
349
- throughputTrackerDelete .eventsIn (noOfEvents );
341
+ try {
342
+ if (throughputTrackerDelete != null &&
343
+ Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
344
+ throughputTrackerDelete .eventsIn (noOfEvents );
345
+ }
346
+ if (latencyTrackerDelete != null &&
347
+ Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
348
+ latencyTrackerDelete .markIn ();
349
+ }
350
+ delete (deletingEventChunk , compiledCondition );
351
+ } finally {
352
+ if (latencyTrackerDelete != null &&
353
+ Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
354
+ latencyTrackerDelete .markOut ();
355
+ }
350
356
}
351
357
}
352
358
@@ -418,18 +424,21 @@ protected void onUpdateError(ComplexEventChunk<StateEvent> updatingEventChunk, C
418
424
public void updateEvents (ComplexEventChunk <StateEvent > updatingEventChunk ,
419
425
CompiledCondition compiledCondition ,
420
426
CompiledUpdateSet compiledUpdateSet , int noOfEvents ) {
421
- if (latencyTrackerUpdate != null &&
422
- Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
423
- latencyTrackerUpdate .markIn ();
424
- }
425
- update (updatingEventChunk , compiledCondition , compiledUpdateSet );
426
- if (latencyTrackerUpdate != null &&
427
- Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
428
- latencyTrackerUpdate .markOut ();
429
- }
430
- if (throughputTrackerUpdate != null &&
431
- Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
432
- throughputTrackerUpdate .eventsIn (noOfEvents );
427
+ try {
428
+ if (throughputTrackerUpdate != null &&
429
+ Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
430
+ throughputTrackerUpdate .eventsIn (noOfEvents );
431
+ }
432
+ if (latencyTrackerUpdate != null &&
433
+ Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
434
+ latencyTrackerUpdate .markIn ();
435
+ }
436
+ update (updatingEventChunk , compiledCondition , compiledUpdateSet );
437
+ } finally {
438
+ if (latencyTrackerUpdate != null &&
439
+ Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
440
+ latencyTrackerUpdate .markOut ();
441
+ }
433
442
}
434
443
}
435
444
@@ -506,19 +515,22 @@ public void updateOrAddEvents(ComplexEventChunk<StateEvent> updateOrAddingEventC
506
515
CompiledCondition compiledCondition ,
507
516
CompiledUpdateSet compiledUpdateSet ,
508
517
AddingStreamEventExtractor addingStreamEventExtractor , int noOfEvents ) {
509
- if (latencyTrackerUpdateOrInsert != null &&
510
- Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
511
- latencyTrackerUpdateOrInsert .markIn ();
512
- }
513
- updateOrAdd (updateOrAddingEventChunk , compiledCondition , compiledUpdateSet ,
514
- addingStreamEventExtractor );
515
- if (latencyTrackerUpdateOrInsert != null &&
516
- Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
517
- latencyTrackerUpdateOrInsert .markOut ();
518
- }
519
- if (throughputTrackerUpdateOrInsert != null &&
520
- Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
521
- throughputTrackerUpdateOrInsert .eventsIn (noOfEvents );
518
+ try {
519
+ if (throughputTrackerUpdateOrInsert != null &&
520
+ Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
521
+ throughputTrackerUpdateOrInsert .eventsIn (noOfEvents );
522
+ }
523
+ if (latencyTrackerUpdateOrInsert != null &&
524
+ Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
525
+ latencyTrackerUpdateOrInsert .markIn ();
526
+ }
527
+ updateOrAdd (updateOrAddingEventChunk , compiledCondition , compiledUpdateSet ,
528
+ addingStreamEventExtractor );
529
+ } finally {
530
+ if (latencyTrackerUpdateOrInsert != null &&
531
+ Level .BASIC .compareTo (siddhiAppContext .getRootMetricsLevel ()) <= 0 ) {
532
+ latencyTrackerUpdateOrInsert .markOut ();
533
+ }
522
534
}
523
535
}
524
536
0 commit comments