【发布时间】:2011-08-16 17:04:31
【问题描述】:
访问方法“foo”的不同线程是否有自己的局部变量副本,或者需要使该方法同步?
class X {
static returnType foo( Object arg) {
Object localvar;
// perform some calculation based on localvar and arg.
// no non-local variable is used i.e: this is a utility method.
// return something.
}
}
【问题讨论】:
-
我可以推荐《Java 并发实践》一书,以解决您可能遇到的任何其他问题。
标签: multithreading concurrency static synchronization