Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Making Data class Singleton.. Providing the database consistency problem?

Ken Kirin
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a question about the Data Singleton class. If I have to use the same Data class, which is in "suncertify.db" package, both in standalone mode and networked mode. Suppose that I run a server and I have a network client requesting a servie,the server knows which server database file(from file) should be properly used for this networked mode and the Data Singleton class will be mapped to this server database file. While this should be no problem, if, at the same time, i run this application on this server machine that is servicing that network client, my Data Singleton class now will be mapped to my local database file(in my server machine) then this Data Singleton Class has no longer way to get back to the server database file to service that network client because the Data Singleton class is already mapped to different database file and there is only one instance of the Data class. How could you guys solve this problem? Should I not make the Data class Singleton but I will be raising the thread safe issue then???

Ken Kirin
SCJD(B&S In progress)
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!