【发布时间】:2011-01-04 14:27:27
【问题描述】:
这段java代码是什么意思?它会锁定MyClass的所有对象吗?
synchronized(MyClass.class) {
//is all objects of MyClass are thread-safe now ??
}
上面的代码和这个有什么不同:
synchronized(this) {
//is all objects of MyClass are thread-safe now ??
}
【问题讨论】:
标签: java multithreading synchronization locking synchronized