当前位置: 首页>>代码示例>>Java>>正文


Java MessageId.makeId方法代码示例

本文整理汇总了Java中backtype.storm.tuple.MessageId.makeId方法的典型用法代码示例。如果您正苦于以下问题:Java MessageId.makeId方法的具体用法?Java MessageId.makeId怎么用?Java MessageId.makeId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在backtype.storm.tuple.MessageId的用法示例。


在下文中一共展示了MessageId.makeId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMessageId

import backtype.storm.tuple.MessageId; //导入方法依赖的package包/类
protected MessageId getMessageId(Collection<Tuple> anchors) {
    MessageId ret = null;
    if (anchors != null && ackerNum > 0) {
        Map<Long, Long> anchors_to_ids = new HashMap<>();
        for (Tuple a : anchors) {
            if (a.getMessageId() != null) {
                Long edge_id = MessageId.generateId(random);
                put_xor(pendingAcks, a, edge_id);
                MessageId messageId = a.getMessageId();
                if (messageId != null) {
                    for (Long root_id : messageId.getAnchorsToIds().keySet()) {
                        put_xor(anchors_to_ids, root_id, edge_id);
                    }
                }
            }
        }
        ret = MessageId.makeId(anchors_to_ids);
    }
    return ret;
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:21,代码来源:BoltCollector.java

示例2: getMessageId

import backtype.storm.tuple.MessageId; //导入方法依赖的package包/类
@Override
protected MessageId getMessageId(Collection<Tuple> anchors) {
    MessageId ret = null;
    if (anchors != null) {
        Map<Long, Long> anchors_to_ids = new HashMap<Long, Long>();
        long now = System.currentTimeMillis();
        if (now - lastRotate > rotateTime) {
            pendingAcks.rotate();
            synchronized (pendingTuples) {
                pendingTuples.rotate();
            }
            lastRotate = now;
        }
        for (Tuple a : anchors) {
            // Long edge_id = MessageId.generateId();
            Long edge_id = MessageId.generateId(random);
            synchronized (pendingAcks) {
                put_xor(pendingAcks, a, edge_id);
            }
            MessageId messageId = a.getMessageId();
            if (messageId != null) {
                for (Long root_id : messageId.getAnchorsToIds().keySet()) {
                    put_xor(anchors_to_ids, root_id, edge_id);
                }
            }
        }
        ret = MessageId.makeId(anchors_to_ids);
    }
    return ret;
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:31,代码来源:BoltBatchCollector.java

示例3: boltEmit

import backtype.storm.tuple.MessageId; //导入方法依赖的package包/类
private List<Integer> boltEmit(String out_stream_id,
		Collection<Tuple> anchors, List<Object> values, Integer out_task_id) {
	timer.start();
	try {
		java.util.List<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) {
			Map<Long, Long> anchors_to_ids = new HashMap<Long, Long>();
			if (anchors != null) {
				for (Tuple a : anchors) {
					//Long edge_id = MessageId.generateId();
					Long edge_id = MessageId.generateId(random);
					long now = System.currentTimeMillis();
					if (now - lastRotate > rotateTime) {
						pending_acks.rotate();
						lastRotate = now;
					}
					put_xor(pending_acks, a, edge_id);
					for (Long root_id : a.getMessageId().getAnchorsToIds()
							.keySet()) {
						put_xor(anchors_to_ids, root_id, edge_id);
					}
				}
			}
			MessageId msgid = MessageId.makeId(anchors_to_ids);
			TupleImplExt tupleExt = new TupleImplExt(topologyContext,
					values, task_id, out_stream_id, msgid);
			tupleExt.setTargetTaskId(t);

			taskTransfer.transfer(tupleExt);

		}
		return out_tasks;
	} catch (Exception e) {
		LOG.error("bolt emit", e);
	}finally {
		timer.stop();
	}
	return new ArrayList<Integer>();
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:46,代码来源:BoltCollector.java

示例4: boltEmit

import backtype.storm.tuple.MessageId; //导入方法依赖的package包/类
private List<Integer> boltEmit(String out_stream_id, Collection<Tuple> anchors, List<Object> values, Integer out_task_id) {
    final long start = System.nanoTime();
    try {
        List<Integer> out_tasks;
        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) {
            Map<Long, Long> anchors_to_ids = new HashMap<Long, Long>();
            if (anchors != null) {
                for (Tuple a : anchors) {
                    // Long edge_id = MessageId.generateId();
                    Long edge_id = MessageId.generateId(random);
                    long now = System.currentTimeMillis();
                    if (now - lastRotate > rotateTime) {
                        pending_acks.rotate();
                        lastRotate = now;
                    }
                    put_xor(pending_acks, a, edge_id);
                    for (Long root_id : a.getMessageId().getAnchorsToIds().keySet()) {
                        put_xor(anchors_to_ids, root_id, edge_id);
                    }
                }
            }
            MessageId msgid = MessageId.makeId(anchors_to_ids);
            TupleImplExt tupleExt = new TupleImplExt(topologyContext, values, task_id, out_stream_id, msgid);
            tupleExt.setTargetTaskId(t);

            taskTransfer.transfer(tupleExt);
        }
        return out_tasks;
    } catch (Exception e) {
        LOG.error("bolt emit", e);
    } finally {
        long end = System.nanoTime();
        timer.update((end - start) / TimeUtils.NS_PER_US);
    }
    return new ArrayList<Integer>();
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:43,代码来源:BoltCollector.java


注:本文中的backtype.storm.tuple.MessageId.makeId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。