• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Transactions and Synchronise blocks

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello..
I want to know that where to use synchronise blocks , and what is the difference between handling transactions and synchronosed blocks.
Thanks
Faisal Ishaque
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"faisal"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it
here.
Just add your last name to your profile.
Also you posted your question in the Servlets forum. Your question isn't really about Servlets at all, it is really a Java in General type question. I am going to move this thread to that forum.
But, for an answer, a Synchronized method only allows one caller at a time to call the method, so if two calls are made at the same time, one of the calls will have to wait for the other to finish first.
Now a transaction is an atomic process. Meaning all the code within the transaction completes, or none of it is allowed to complete. In the database world, say you are adding three new records within this transaction, if any one of those records fail to add, then none of the three records are added.
Thanks! and welcome to the JavaRanch!
Mark
reply
    Bookmark Topic Watch Topic
  • New Topic