As stated in the header, I have some code wrapped in an infinite loop while(true), and they are all completely caught in tryand blocks catch. However, this thread starts in the main method, but after a long start this workflow disappears mysteriously when I check the use of jstack and impose the accumulated work.
Below is my code:
public void run() {
while (true) {
try {
Global.KAFKA_METRIC_DATA_CONSUMER.consume(topic, handler);
} catch (Exception e) {
logger.error("Kafka consumer process was interrupted by exception!");
} finally {
try {
Thread.sleep(30 * BaseConst.SECOND);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
In my opinion, this structure will support the flow that is the consumer. Even if the consumption methods () failed, it will restart endlessly. However, as I mentioned above, the whole thread disappears without any error log. Can someone give some clues please?
Additional information that may be helpful:
- ,
.
.
- java, ,
- ,
gc . -
.