| Java FAQ | ||
| JSP FAQ | ||
| Servlet FAQ | ||
XyzWs Java FAQ:
Can other threads access unsynchronized methods when a thread executing a synchronized method?
Printer-friendly version |
Mail this to a friend
|
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. |