Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S v2.3.1 - Data, CacheManager and RecordNotFoundException

 
Arun Subramanian
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy all -
After a very long hiatus, I have started working on my assignment once more. Please comment on my BS design and code reached thus far on Data, CacheManager and RecordNotFoundException. I would really like to hear if any others have similar approaches for preloading cache etc. To give context to some of the code snippets below, a brief description of some relevant components is in order:
  • Each client gets its own Data object.
  • There's a LockManager singleton and a CacheManager singleton in the JVM.
  • The CacheManager's collection object (map) will be preloaded by the first data instance that gets to it. CacheManager's cache collection caches all the records available in the db file.
  • Data's read method reads "only" from the cache while update, delete and create methods update the cache.
  • RecordNotFoundException is thrown when a record doesn't exist in the cache or is a deleted record.
  • The readRecordFromCache method is synchronized while isRecordInCache is not.
  • The Record class encapsulates the data in the record and whether it's an active record.



  • Thank you for your time.

    Thanks,
    Arun.

    [ March 23, 2006: Message edited by: Arun Subramanian ]
    [ March 24, 2006: Message edited by: Arun Subramanian ]
     
    R Joshi
    Greenhorn
    Posts: 13
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Caching is fine but you may need to persist the data in filesystem at regular intervals(?)
    Note:According to the specs 'the data must continue to be manipulated for reports using another custom-written application'
     
    Arun Subramanian
    Ranch Hand
    Posts: 47
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Caching is fine but you may need to persist the data in filesystem at regular intervals(?)
    Note:According to the specs 'the data must continue to be manipulated for reports using another custom-written application

    My bad in probably not explaining it well. I try to keep the file and the cache in sync. I should have said:
  • Data's read method reads "only" from the cache while update, delete and create methods update the file and then update the cache. In other words, of the CRUD operations, R is a cache only operation while C, U and D first modify the file and then sync the cache.


  • Thanks.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic