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 Create() 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 "Create()" Watch "Create()" New topic


GD Deepz
Ranch Hand

Joined: Sep 29, 2004
Posts: 55
This has probably been asked before but I guess locking will not be required for create(). There is really nothing to lock. However, the actual writing of the data to the database will be sychronized as such the database itself need not be "locked" --- Is this correct?

X-Mas and Happy New year to everyone
Jared Chapman
Ranch Hand

Joined: Feb 23, 2004
Posts: 81
I didn't use locking with create(). I keep a list containing record numbers of deleted records. I synchronize on this list, create the record at the record number contained in the first index of the list, and if successful, remove this record number from the list of deleted record numbers. If the list of deleted records is empty, I simply add the record to the end of the file.

B.S. University of Wisconsin<br />SCJP 1.4 (85%)<br />SCJD 1.4 (92%) B&S Contractors
I agree. Here's the link:
subject: Create()
It's not a secret anymore!