Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can isolation level 'serial' produce the same protection as the 'synchronized' keyword?

 
Jef Smith
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on a Java course registration app that contains the following code:


course.getNumberOfOpenings() runs a query to get the number of openings so this situation seems to call for a synchronize block to prevent a swap out of the thread after the number of openings check but before the actual registration but there is no synchronization code of any kind.

However, immediately before this block is executed the isolation level of the JDBC connection is set to 'serial'. Does this isolation level provide the equivalent protection of a synchronized block in this case?

Thanks for any insight into this,
JefS
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic