如何在父类上同步嵌套的Java类方法?

时间:2015-09-13 12:16:50

标签: java multithreading synchronization

我有两个班级

set

据我所知,方法SELECT t1.* ,(SELECT COUNT(*) FROM TABLE2 t2 WHERE t1.id = t2.id) AS Counter FROM TABLE1 t1 WHERE t1.status = 'A'; 在类public class A { private byte[] buf; public synchronized void foo() { // does something with buf } public class B { public synchronized void bar() { // also does something with buf } } } 的实例上同步。如何在课程bar()的对象上同步它以保护B

0 个答案:

没有答案