Home  |   STIU  |   WOW  |   SCJP  |   SCDJWS   |   JEE FAQ  |   About US  |  

FAQ
  Java FAQ
  JSP FAQ
  Servlet FAQ
 

Advertisement

XyzWs Java FAQ:
Can other threads access unsynchronized methods when a thread executing a synchronized method?


Printer-friendly version Printer-friendly version | Send this 
article to a friend Mail this to a friend


Previous Next vertical dots separating previous/next from contents/index/pdf Contents
Advertisement
Can other threads access unsynchronized methods when a thread executing a synchronized method?

Can other threads access unsynchronized methods when a thread executing a synchronized method?

Yes, they can.

Each object in Java is associated with a monitor, which a thread can lock or unlock. To enter a synchronized method, a thread must lock on the monitor and other threads must wait the lock released. To enter an unsynchronized method, a thread does not need the lock at all. So other threads can access unsynchronized method with no interference.


Previous Next vertical dots separating previous/next from contents/index/pdf Contents

Support  | Feedback  | Help