• 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

Synchronization

 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
I have a database table, web service, and multiple web clients.
My web service can have multiple unrelated instances (running on separate jvms).
The web clients might hit the services and ask for records from the table. What I want to avoid is that 2 clients will get the same row of the table simultaneously (or while other service is processing it) from the same instance of the service or multiple instances.
If I synchronize the piece of code that accesses the DB on the service side it won�t help me because other service from other jvm might still give this row to other client.
How do I solve this?

Thanks,
John
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some databases have row-level locking; would that help?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


What I want to avoid is that 2 clients will get the same row of the table simultaneously (or while other service is processing it) from the same instance of the service or multiple instances.


If you are running with a high enough transaction isolation level, why does this matter?
 
reply
    Bookmark Topic Watch Topic
  • New Topic