EE3206/ EE5805 Java Programming and Applications
14.3.2 static synchronized mtehods,
notes from Gosling etc. "The Java progamming Language"
1. A static synchronized method acquires the lock of the Class object for its class. If static data is shared between threads then access to it must be protected by static synchronized methods.
2. Acquiring the Class object lock in a static synchronized method has no effect on any objects ofthat class.
3. You can still invoke synchronized methods on an object while another thread holds the Class object lock in a static synchronized method, only other static synchronized methods are blocked.
Keine Kommentare:
Kommentar veröffentlichen