multithreading - Non-synchronised methods of an object in Java? -


i need clear few basic concepts check whether understanding correct or not.

1) once thread enters synchronized method on instance, no other thread can enter other synchronized method on same instance.

2) however, nonsynchronized methods on instance continue callable (by other threads). if yes, can whole object doesn't gets locked critical methods synchronized.

3) same behaviour above synchronized statement too:

synchronised(this){       // statements synchronised   } 

or whole object gets locked here nonsynchronized methods on instance not callable.

i think pretty confused locking scope.

a lock prevents other threads acquiring same lock -- lock has no idea protects -- it's 1 thread can have. whole object locked because other thread attempts lock whole object unable acquire lock until it's released. otherwise, understanding correct.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -