• 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

So should lock synchronize on cache

 
Ranch Hand
Posts: 435
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've found the synchronization disscussions very interesting. And I think it might be best to synchronize on my cache for read and write.
But if I take this to it's logical extreme wouldn't I also have to synchronize on my cache in lockRecord as well, to avoid a dirty read ? As I need to check the record is actually in the cache, for the RecordNotFoundException.

Tony
 
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
I don't understand you question based on the cache. Are you storing your data in cache when you first start up the client, and therefore the cache will not get updated ever from the server or data class?
I would not cache the data at all. It isn't necessary or a requirement. If you need to read the data always read directly form the data file.
As far as Dirty reads, if you read from the file when you ask for data, then you do not need to worry about dirty reads. And you really shouldn't care about dirty reads for this assignment. It is not a requirement.
It is possible that you do a search, get records back, another client books some data, and the original client still does not see the booking. That is fine for this assignment. You just need to reread the record right after lock and just before booking/modifying the record.
Mark
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic