• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in Synchronizd Block  RSS feed

 
Suhani arora
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All !!
Frnds any body Please tell me When a process is in Synchronized block and Exception genrate which is catch after synchronized block .Will this process releinquish all resource which it has in synchonized block

Example :-
connection con=..;
PreparedStatement pstmt=....
synchronized(this)
{
-----

pstmt.executeUpdate();//SQLException genrate here

}

----
catch(here)
{
}
//will this process unlock the table
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Java in General (intermediate) forum.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. No matter how the synchronized block is exited (returning, falling off the end, or an exception), the monitor will be released.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!