This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Corejava Question ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Corejava Question ?? " Watch "Corejava Question ?? " New topic
Author

Corejava Question ??

Sirish Reddy
Greenhorn

Joined: Sep 16, 2004
Posts: 7
How can i lock an Object ?
Ashish Chopra
Ranch Hand

Joined: Nov 30, 2004
Posts: 134
Hi

Can you clarfiy what is the exact funtionality that you require from this lock? Is it lock in case the object is being used by someone else(in case of a multithreaded environment), or is it that the object is not available/ visible to others?


Quis Custodiet Ipsos Custodes<br /> <br />My blog: <a href="http://www.coherentrambling.blogspot.com" target="_blank" rel="nofollow">http://www.coherentrambling.blogspot.com</a>
tue march
Greenhorn

Joined: Mar 09, 2005
Posts: 16
hi sirish,

Basically locking an object comes during synchronization areas.

synchronization means only one can access anything.

For example, say myself and u have the same debit card ie having same number on credit card ( we have two copies of credit card with same number).

Suppose i insert card into ATM, at that particular point of time, u are not allowed to access the database (i,e you cant touch data unless one card has finished its transcation) means when one transaction is accessing data, ( indirectly object is locked), u cant allow other transaction to access data.

Have a nice day.
Good Guy
 
wood burning stoves
 
subject: Corejava Question ??