File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes locking the entire db?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "locking the entire db??" Watch "locking the entire db??" New topic

locking the entire db??

subu ananthram
Ranch Hand

Joined: May 16, 2004
Posts: 102
I am wondering if there is another way out of this sticky situation.
I have a file access class like many others that my Data class calls.
Now I synchronize on the random acces file instance which is static to my fileaccess class and there is only one instance of my file access class
the idea is so that one thread at a time plays with the raf and my file pointers dont go crazy .This will make the application perform badly since only one thread can do anything with the random access file ...Is there some other way of doing this...Please comment
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
Just make sure the synchronised blocks are as small as possible.

I agree. Here's the link:
subject: locking the entire db??
It's not a secret anymore!