backtype.storm.tuple.Tuple.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(100)

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

Tuple.<init>介绍

暂无

代码示例

代码示例来源:origin: alibaba/mdrill

public static void send(TopologyContext topologyContext,
    TaskSendTargets taskTargets, WorkerTransfer transfer_fn,
    String stream, List<Object> values) {
  java.util.Set<Integer> tasks = taskTargets.get(stream, values);
  Integer taskId = topologyContext.getThisTaskId();
  Tuple tup = new Tuple(topologyContext, values, taskId, stream);
  for (Integer task : tasks) {
    transfer_fn.transfer(task, tup);
  }
  }
}

代码示例来源:origin: alibaba/mdrill

public Tuple deserialize(byte[] ser) {
    try {
      ByteArrayInputStream bin = new ByteArrayInputStream(ser);
      DataInputStream in = new DataInputStream(bin);
      int taskId = WritableUtils.readVInt(in);
      int streamId = WritableUtils.readVInt(in);
      String componentName = _context.getComponentId(taskId);
      String streamName = _ids.getStreamName(componentName, streamId);
      MessageId id = MessageId.deserialize(in);
      List<Object> values = _kryo.deserializeFrom(bin);
      return new Tuple(_context, values, taskId, streamName, id);
    } catch(IOException e) {
      throw new RuntimeException(e);
    }
  }
}

代码示例来源:origin: alibaba/mdrill

private List<Integer> boltEmit(String out_stream_id,Collection<Tuple> anchors, List<Object> values, Integer out_task_id) {
try {
  java.util.Set<Integer> out_tasks = null;
  if (out_task_id != null) {
  out_tasks = sendTargets.get(out_task_id, out_stream_id, values);
  } else {
  out_tasks = sendTargets.get(out_stream_id, values);
  }
  for (Integer t : out_tasks) {
  HashMap anchors_to_ids = new HashMap();
  if (anchors != null) {
    for (Tuple a : anchors) {
    Long edge_id = MessageId.generateId();
    TasksCommon.put_xor(pending_acks, a, edge_id);
    for (Long root_id : a.getMessageId().getAnchorsToIds().keySet()) {
      TasksCommon.put_xor(anchors_to_ids, root_id, edge_id);
    }
    }
  }
  MessageId msgid=MessageId.makeId(anchors_to_ids);
  workerTransfer.transfer(t,new Tuple(topologyContext, values, task_id,out_stream_id, msgid));
  }
  return StormUtils.mk_list(out_tasks);
} catch (Exception e) {
  LOG.error("bolt emit", e);
}
return new ArrayList<Integer>();
}

代码示例来源:origin: alibaba/mdrill

Tuple tp = new Tuple(topology_context, values, task_id,out_stream_id, msgid);
transfer_fn.transfer(t, tp);

相关文章