• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

About real synchronized applications  RSS feed

clojure forum advocate
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have developed a Teller swing application (modifying user's balance and ...).
in this application, I have a modifyBalance( ) method that modifies user's balance.
in the real world (where there are many tellers), should I declare modifyBalance( ) with the synchronized keyword (to be sure about data integrity)??
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That probably depends on what class modifyBalance() is in. If it's in a Teller class, then synchronizing on the Teller won't help you much - because two different Tellers will still be able to acto concurrently, and that's the problem in this case - you don't want them accessing the Balance simultaneously. But if modifyBalance() is in the Balance class, then synchroning that method will probably help ensure data integrity - because only one synchronized method of a given Balance may run at once, regardless of which Teller is calling the method. It's hard to say more here without more details about the system.
[ February 20, 2004: Message edited by: Jim Yingst ]
Evacuate the building! Here, take this tiny ad with you:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!