org.apache.storm.utils.Utils.tuple()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中org.apache.storm.utils.Utils.tuple()方法的一些代码示例,展示了Utils.tuple()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.tuple()方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:tuple

Utils.tuple介绍

暂无

代码示例

代码示例来源:origin: apache/storm

public List<Object> deserialize(ByteBuffer ser) {
  // Maintain backward compatibility for 0.10
  byte[] b = Utils.toByteArray(ser);
  return Utils.tuple(new Object[]{ b });
}

代码示例来源:origin: apache/storm

@Override
public Iterable<List<Object>> deserialize(ByteBuffer ser) {
  return asList(Utils.tuple(Utils.toByteArray(ser)));
}

代码示例来源:origin: apache/storm

public void execute(Tuple input, BasicOutputCollector collector) {
  total = total.add(new BigInteger(input.getValues().get(1).toString()));
  collector.emit(tuple(total.toString()));
  //prints the total with low probability.
  if (RANDOM.nextInt(1000) > 995) {
    LOG.info("Running total = " + total);
  }
}

代码示例来源:origin: apache/storm

public void execute(Tuple input, BasicOutputCollector collector) {
  total = total.add(new BigInteger(input.getValues().get(1).toString()));
  collector.emit(tuple(total.toString()));
  //prints the total with low probability.
  if(RANDOM.nextInt(1000) > 995) {
    LOG.info("Running total = " + total);
  }
}

代码示例来源:origin: apache/storm

public void execute(Tuple input, BasicOutputCollector collector) {
  String word = getTupleValue(input, 0);
  int count = 0;
  if (_counts.containsKey(word)) {
    count = _counts.get(word);
  }
  count++;
  _counts.put(word, count);
  collector.emit(tuple(word, count));
}

代码示例来源:origin: apache/storm

public void execute(Tuple input) {
  String word = (String) input.getValues().get(0);
  int count = (Integer) input.getValues().get(1);
  _counts.put(word, count);
  int globalCount = 0;
  for (String w : _counts.keySet()) {
    globalCount += _counts.get(w);
  }
  _collector.emit(tuple(globalCount));
  _collector.ack(input);
}

代码示例来源:origin: apache/storm

public void execute(Tuple input, BasicOutputCollector collector) {
  collector.emit(tuple(input.getValues().get(0), 1));
}

代码示例来源:origin: apache/storm

public void execute(Tuple input, BasicOutputCollector collector) {
  collector.emit(tuple(input.getValues().get(0), 1));
}

代码示例来源:origin: com.twitter.heron/heron-storm

@Override
public List<Object> deserialize(ByteBuffer ser) {
 byte[] bytes = new byte[ser.remaining()];
 ser.get(bytes);
 return tuple(bytes);
}

代码示例来源:origin: com.twitter.heron/heron-storm

@Override
public Iterable<List<Object>> deserialize(ByteBuffer ser) {
 byte[] bytes = new byte[ser.remaining()];
 ser.get(bytes);
 return asList(tuple(bytes));
}

代码示例来源:origin: org.apache.storm/storm-core

@Override
public Iterable<List<Object>> deserialize(ByteBuffer ser) {
 return asList(tuple(Utils.toByteArray(ser)));
}

代码示例来源:origin: org.apache.storm/storm-core

public List<Object> deserialize(ByteBuffer ser) {
  // Maintain backward compatibility for 0.10
  byte[] b = Utils.toByteArray(ser);
  return tuple(new Object[]{b});
}

代码示例来源:origin: org.apache.storm/storm-core

public void execute(Tuple input, BasicOutputCollector collector) {
  String word = getTupleValue(input, 0);
  int count = 0;
  if(_counts.containsKey(word)) {
    count = _counts.get(word);
  }
  count++;
  _counts.put(word, count);
  collector.emit(tuple(word, count));
}

代码示例来源:origin: org.apache.storm/storm-core

public void execute(Tuple input) {
  String word = (String) input.getValues().get(0);
  int count = (Integer) input.getValues().get(1);
  _counts.put(word, count);
  int globalCount = 0;
  for(String w: _counts.keySet()) {
    globalCount+=_counts.get(w);
  }
  _collector.emit(tuple(globalCount));
  _collector.ack(input);
}

相关文章

微信公众号

最新文章

更多

Utils类方法