Java Synchronization callstack -
suppose there synchronized method in turn calls other ordinary methods shown below:
public static synchronized void dosomething(){ doit1(); } public doit1(){ doit2(); }
my question is, when have above code , call dosomething(), synchronized method, method synchronized, or subsequent methods called, doit1 & doit2, synchronized?
my question is, when have above code , when call dosomething() synchronized method method synchronized or subsequent methods call doit1 & doit2 synchronized ?
only calls dosomething()
synchronized; direct calls doit1()
or others not, unless those calls use locking of kind.
that is, if call doit1()
, jvm won't @ call sites method , see "oh, there synchronized call site method synchronize accesses method well".
in short: jvm assumes know doing.
Comments
Post a Comment