不知道什么关键字触发 403 Forbidden nginx 了,我一段段打
synchronized (Vector.this) {
三: SynchronizedList和Vector的区别?只回答sync相关的区别即可(比如Collections#synchronizedList(ArrayList)与Vector)
#SynchronizedList和Vector的区别,网上搜到一个但没没明白要点
#老是被ban,不知道触发了什么关键字,浏览器Console执行下
["h","t","t","p","s",":","/","/","w","w","w",".","h","o","l","l","i","s","c","h","u","a","n","g",".","c","o","m","/","a","r","c","h","i","v","e","s","/","4","9","8"].join("/")
1
jsshaojinjie 2019-04-09 08:27:58 +08:00
是为了线程安全
|
2
c4f36e5766583218 OP fix: 打错了,是.join("")
@jsshaojinjie #1 * 哦,我搞错了,问题 1 应该是这样: 这样写是保证 Vector.Itr 创建的实例是线程安全的,比如 Vector.Itr#remove()方法内部```remove(lastRet);```不会并发导致数据多删,(线程安全并不是说不会报错,像 remove 的话还是可能 ArrayIndexOutOfBoundsException 的) * 那问题 3 应该就是说 SynchronizedList 返回的 Iterator 并不一定是线程安全的 updated: 那看下问题 2 吧。 |
3
jsshaojinjie 2019-04-11 08:28:04 +08:00
@c4f36e5766583218 哪个是问题 2
|
4
c4f36e5766583218 OP @jsshaojinjie #3 问题 2=第 1 条附言
|