Clean useless InterruptedException warn in ingestion task log (#15519)

* Clean useless InterruptedException warn in ingestion task log

* test coverage for the code change, manually close the scheduler thread to trigger Interrupt signal

---------

Co-authored-by: Qiong Chen <qiong.chen@shopee.com>
This commit is contained in:
sensor 2023-12-15 11:18:53 +08:00 committed by GitHub
parent 9deeb288c5
commit c9be1cb4e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -181,6 +181,10 @@ public class KafkaEmitter implements Emitter
} }
} }
catch (Throwable e) { catch (Throwable e) {
if (e instanceof InterruptedException && e.getMessage() == null) {
log.info("Normal exit.");
return;
}
log.warn(e, "Exception while getting record from queue or producer send, Events would not be emitted anymore."); log.warn(e, "Exception while getting record from queue or producer send, Events would not be emitted anymore.");
} }
} }

View File

@ -140,6 +140,8 @@ public class KafkaEmitterTest
} }
countDownSentEvents.await(); countDownSentEvents.await();
kafkaEmitter.close();
Assert.assertEquals(0, kafkaEmitter.getMetricLostCount()); Assert.assertEquals(0, kafkaEmitter.getMetricLostCount());
Assert.assertEquals(0, kafkaEmitter.getAlertLostCount()); Assert.assertEquals(0, kafkaEmitter.getAlertLostCount());
Assert.assertEquals(0, kafkaEmitter.getSegmentMetadataLostCount()); Assert.assertEquals(0, kafkaEmitter.getSegmentMetadataLostCount());