synchronized锁住的是括号里面的对象,而不是代码。

对于非static的synchronized方法,锁的就是对象本身,也就是this。

posted on 2018-04-20 14:36  帅过驴的袋鼠  阅读(2194)  评论(0编辑  收藏  举报