Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file.
but because the data must continue to be manipulated for reports using another custom-written application,
Originally posted by Satish Avadhanam:
So what is concerning me is do we have to read all the records present in the db file everytime we access it? I mean there is always a chance that other applications might be adding or deleting the existing records right? What if our application is used only to pull the db file and show and other applications are used to add and delete records? Then we have to read all the records in the db file everytime we access it, say we want to read, delete and other operations.
Am I correct? Or totally wrong? Guys...please, any comments on this?
Locking
Your server must be capable of handling multiple concurrent requests, and as part of this capability, must provide locking functionality as specified in the interface provided above. You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server. Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU, consuming no CPU cycles until the desired resource becomes available.
Regards, George
SCJP, SCJD, SCWCD, SCBCD
Originally posted by George Marinkovich:
HI Satish,
At any one time there is only one application accessing the database file. In other words, we do not have to worry about the legacy application accessing the database file while our application is running. Similarly, we do not have to worry about two instances of our application running in standanlone mode on the same machine accessing the same database file.
So, you think reading all db file records at the start of the application (and adding any created records to that) should work and we don't have to do reading from db file each and everytime. OK, thanks.
In my opinion Sun is explicitly offering us a simplifying assumption and we are foolish not to take them up on the offer.
![]()
![]()
Its just that we are putting so much effort(ofcourse money too) to pass the test right. So don't want to let it go for small statements and if anyone here(You, Phil, Javini) assures that its ok, it will be a relief.
"Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file."
The following methods throw RNFE: read, update, delete & lock. Here is what am doing right now. I populate two static ArrayList's existingRecords and deletedRecords before any client access the dbfile.
Later on, I use those two arraylist to find out whether the record exists or not or whether the record is already deleted or not like that. If any new record is created using the create method I add that record
to the existingRecords arraylist. So what I exactly do at the time of checking for the RNFE in the above methods is to check whether the recNo is present in the existingRecords. If not it will throw RNFE. Does this approach fulfill the RNFE requirement?