【发布时间】:2015-12-09 11:01:16
【问题描述】:
我看到很多代码 sn-ps 在Spout.nextTuple() 中使用了一个循环(例如读取整个文件并为每一行发出一个元组):
public void nextTuple() {
// do other stuff here
// reader might be BufferedReader that is initialized in open()
String str;
while((str = reader.readLine()) != null) {
_collector.emit(new Values(str));
}
// do some more stuff here
}
这段代码看起来很简单,但是,有人告诉我不应该在nextTuple() 内循环。问题是为什么?
【问题讨论】:
标签: apache-storm