ConcurrentSkipListSet在指定比较器后并发add,结果顺序错误?
private ConcurrentSkipListSet<COon>coon
=new ConcurrentSkipListSet<COon>(new Comparator<COon>() {
public int compare(COon arg0, COon arg1) {
return arg0.getKey()-arg1.getKey();
}
});
/**此部分并发调用columnOption的add方法,代码略**/
for(COon coon:this.coon){
System.out.println(coon.getKey());
}
/*结果是随机顺序,为啥呢?*/
/*测试非并发调用add,则结果是升序排列*/
[解决办法]
自己顶一下,其实以前见过有人在博客里解释这个问题,但太久之前看的,具体内容忘掉了...
[解决办法]
继续顶....
[解决办法]
该回复于2012-08-10 09:50:29被版主删除