• 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

[NX: URLyBird] thread safe Data objects?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an implementation of the Data class ( used to access the database file) that is not thread-safe. I have one Data object to each client connection and synchronize write/delete/update through a locking mechanism using static member objects. This implementation will maintain database integraty when each client serializes it's calls to the Data object.
The data class can easily be converted to be thread-safe by simply adding 'synchronize' to each of the member function declarations. This should not effect the performance of the data access too much ( there will not be any contention on the object).
My question is; is it better to have the Data class thread-safe or not? It is not part of my specific project requirements, but maybe for future client development?
 
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Chris,
I also have URLy Bird assignment and I have done the thread management with Andrew and Max's help in the following thread (post) really. I suggest you go through it thoroughly. There are a number of other threads out there as well on this topic. They pretty much walked me through the development of what I think is a rather neat solution. Enjoy!
Topic: NX: About data consistent
 
Can't .... do .... plaid .... So I did this tiny ad instead:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic