FAQ

Java

JSP

Servlet


Advertisement



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.


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

  |   |