This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes doubt on synchronized block-3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply locked New topic
Author

doubt on synchronized block-3

shankara me
Greenhorn

Joined: Nov 30, 2012
Posts: 14
the general form of synchronized block is
----------------------------------------------------------
In the above code,i wrote synchronized(obj).Here obj means object of table class or it may be object of a string class or object of Integer class or it may be any object of any class.
If we write this in place of obj it means it is object of table class.That means we are geting lock on table class.
In below programme I got lock on table class by putting this in place of obj.
But I am not able to write a programme to get lock on object of other than table class.
I want a programme which gets lock on object other than table class.
can any one give such type of programme?
you no need to write entire programme.you simply edit below programme.
-----------------------------------------------------------------------------------------------------------------------------------------------

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19059
    
  40


Starting another topic to ask the same question again is a bit inefficient isn't it? Would it not be easier to simply follow up on your previous topic?

http://www.coderanch.com/t/599436/threads/java/synchronized-block-java

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doubt on synchronized block-3