本文整理匯總了Java中org.apache.storm.tuple.Tuple.getIntegerByField方法的典型用法代碼示例。如果您正苦於以下問題:Java Tuple.getIntegerByField方法的具體用法?Java Tuple.getIntegerByField怎麽用?Java Tuple.getIntegerByField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.storm.tuple.Tuple
的用法示例。
在下文中一共展示了Tuple.getIntegerByField方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import org.apache.storm.tuple.Tuple; //導入方法依賴的package包/類
public void execute(Tuple tuple) {
if(tuple.getSourceComponent().equals(UPSTREAM_COMPONENT_ID)){
String word = tuple.getStringByField(UPSTREAM_FIEDLS);
if(word.length() <= 0) {
collector.ack(tuple);
return;
}
collector.emit(Constraints.coinFileds, new Values(word));
Key ky = new Key(word.getBytes());
if(bf.membershipTest(ky))
collector.emit(Constraints.hotFileds, tuple, new Values(word));
else
collector.emit(Constraints.nohotFileds, tuple, new Values(word));
}else {
String key = tuple.getStringByField(Constraints.wordFileds);
Integer type = tuple.getIntegerByField(Constraints.typeFileds);
Key hk = new Key(key.getBytes());
if(!bf.membershipTest(hk) && type.equals(1))
bf.add(hk);
if(bf.membershipTest(hk) && type.equals(0))
bf.delete(hk);
}
collector.ack(tuple);
}
示例2: execute
import org.apache.storm.tuple.Tuple; //導入方法依賴的package包/類
public void execute(Tuple tuple) {
final String word = tuple.getStringByField(Constraints.wordFileds);
Integer count = tuple.getIntegerByField(Constraints.coinCountFileds);
predictorHotKeyUtil.PredictorHotKey(word,count);
if(predictorHotKeyUtil.isHotKey(word))
collector.emit(new Values(word,1));
predictorHotKeyUtil.SynopsisHashMapRandomDump(new DumpRemoveHandler() {
@Override
public void dumpRemove(String key) {
collector.emit(new Values(word,1));
}
});
collector.ack(tuple);
}