aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Multithreading Data side? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Multithreading Data side?" Watch "Multithreading Data side?" New topic
Author

Multithreading Data side?

Matt Ghiold
Ranch Hand

Joined: Feb 24, 2002
Posts: 213
Hey guys,
Is everyone keeping single thread's to the db.db file, or are you all building a threading pooling off the network server to give multithreaded access to the db file.
Thoughts?
-Matt


-Matt<br /> SCJP2<br /> SCJD
Abhinav Anand
Ranch Hand

Joined: May 02, 2002
Posts: 113
Hi Matt,
I have not implemented any sort of thread pool for making my server multithreaded. I am relying on RMI to create a new thread for every request and optimizing the use of threads.
Moreover I have only once instance of data class for every database. This instance is bound to the RMIRegistry, so there is only one instance of db.db active at one time.
Hope it helps.
Any suggetions are welcome,
Thanks,
Abhinav
Matt Ghiold
Ranch Hand

Joined: Feb 24, 2002
Posts: 213
Actually, what I was considering doing was to make my RMI network layer infront of my database class. Then, I was either going to be single threaded into my db file, or I was going to build a threading pool off my rmi server to access my database. I am believing that this is overkill, and I think your solution is much simpler and more elegant, but I worry about locking/unlocking with each member threading into the data class. directly with RMI. I can see coruption happening if one client add data and another calls delete data. I think that there should be some interim class between the db.db file and the rmi server.
Thoughts?
-Matt
[ May 03, 2002: Message edited by: Matt Ghiold ]
Abhinav Anand
Ranch Hand

Joined: May 02, 2002
Posts: 113
Hi,
You are right in your concern for multiple threads corrupting the data by invoking different methods of a sigle data instance. Even a harmless operation like criteriaFind can cause a genuine modify operation to corrupt the database.
I had some discussion with other members of this group on this issue. See the posting with the topic "thread safety and synchronized". It was posted recently and I think you would find it useful.
Thanks,
Any suggetions are welcome
Matt Ghiold
Ranch Hand

Joined: Feb 24, 2002
Posts: 213
Thank's I will check it out!
-Matt
 
 
subject: Multithreading Data side?