首页 > 其他 > 详细

测试代码

时间:2016-09-03 19:40:17      阅读:125      评论:0      收藏:0      [点我收藏+]
private List<Integer> boltEmit(String out_stream_id,
            Collection<Tuple> anchors, List<Object> values, Integer out_task_id) {
        timer.start();
        List<Integer> out_tasks = null;
        try {
            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);
                        }
                    }
                }


            }
            return out_tasks;
        } catch (Exception e) {
            LOG.error("bolt emit", e);
        }finally {
            timer.stop();
        }
        return new ArrayList<Integer>();
    }

测试代码

原文:http://www.cnblogs.com/catkins/p/5837743.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!