`
cloudeagle_bupt
  • 浏览: 541247 次
文章分类
社区版块
存档分类
最新评论

Hama0.7.1的同步问题

 
阅读更多

读Hama代码发现的同步问题,

实际使用IncomingVertexMessageManager类作为消息管理类,


开始我看到AbstractMessageManager中init函数

this.localQueueForNextIteration = getSynchronizedReceiverQueue();

还以为加了同步,后来发现真没有。。。。



这样会存在IncomingVertexMessageManager中的

public void add(GraphJobMessage item) {
if (item.isVertexMessage()) { //没有执行singeLockQueue的同步代码,存在同步问题!
if (!storage.containsKey(item.getVertexId())) {
storage.putIfAbsent(item.getVertexId(), item);
} else {
storage.get(item.getVertexId()).addValuesBytes(item.getValuesBytes(),
item.size());
}
} else {
mapMessages.add(item);
}
}


不知道为何这样写呢?


真是坑爹啊!

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics