jQuery in Action, 2nd edition
The moose likes Threads and Synchronization and the fly likes Class lock vs Object lock Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Class lock vs Object lock" Watch "Class lock vs Object lock" New topic
Author

Class lock vs Object lock

Amirtharaj Chinnaraj
Ranch Hand

Joined: Sep 28, 2006
Posts: 215
hi guys

i need to know the difference between class level lock and Object level lock

i know that the Object level lock can be achieved by synchronized blocks
if i need no other threads to acess the object.

but what is the necessary of Class level lock.and what conditions i have to think
about Class lock

thanks
amir
Muhammad Khojaye
Ranch Hand

Joined: Apr 12, 2009
Posts: 341
what is the necessary of Class level lock.and what conditions i have to think
about Class lock

see this

Hope it helps


http://muhammadkhojaye.blogspot.com/
Arunan Ramanathan
Greenhorn

Joined: Jul 31, 2007
Posts: 22
//
but what is the necessary of Class level lock.and what conditions i have to think
about Class lock
//

A static method can't be invoked by an object.A static method can be invoked by calling the class name.
So if we call a synchronized static method then it'll acquire the lock of the class.


Scjp 1.4 - 80%
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Class lock vs Object lock
 
Similar Threads
Object Lock and a class level lock
Object locks
Class level lock versus Object level lock
Types of Lock in java object
Synchronized with example