Wouldn't life be easier if we could use any checked exceptions
Originally posted by Omar Kalaldeh:
I am not sure if the picture gets clear.
Again I am talking about unLock method not delete method.
Noooooooooooooooooooo,
you should Lock\Unlock records in deleting just like any other database method, what I was saying there is no need to throw RecordNotFoundException in unLock method
I have a LockCookieGenerator to generate the unique cookie.
I turn the concept of DataAdapter into session facade so that the Data is a singleton. So I can use "synchronized" on the Data object, say the methods in Data other than modifying database are synchronized. I also model the lock as a object, not a pair of cookie/recNo values.
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.
what is raf? I am assuming its the file object.
I think You should put the synchronization block on the Map object.
No need to throw exception when waiting thread get Interrupted.
Should throw securityException not IllegalArgumentException.