I have two sources, one is Kafka source and one is the custom source, I need to make a sleep custom source for one hour but I am getting below interruption.
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.hulu.hiveIngestion.HiveAddPartitionThread.run(HiveAddPartitionThread.java:48)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:100)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:63)
at org.apache.flink.streaming.runtime.tasks.SourceStreamTask$LegacySourceFunctionThread.run(SourceStreamTask.java:201)
Code:
<kafka_Source>.union(<custom_source>)
public class custom_source implements SourceFunction<String> {
public void run(SourceContext<String> ctx) {
while(true)
{
Thread.sleep(1000);
ctx.collect("string");
}
}
}
How to make sleep custom source while Kafka source will continue with its stream. why I am getting thread interruption exception?