Grade: P Score: 362 Comment: This report shows the total number of points awarded for each section. The maximum number of points is 400, to pass you need a score of 320. Section Summary: Section Max Actual Points Points General Con: 100 90 Documentation: 70 65 OOD: 30 30 GUI: 40 27 Locking: 80 80 Data Store: 40 40 Network Server: 40 30 Total: 400 362
I am so happy that I foregot to say thanks to JavaRanch. Because I've learned so lots from JavaRanch. ---------------------------------------------
My lock implementation is very simple. 1. I uses a static Random long seed initialized once JVM started, as a seed of looked cookie generation. 2. I uses a map to store all current available mapping of locked record and cookie. The key of the entry is a record number, the value mapped to the key (record) is the cookie held by a client. 3. I uses the object locked of the map to synchronize the record lock and unlock process. 4. I notify all thread waiting on the object locked of map only after unlocked a record successfully. 5. Make sure that the process of checking if a record is locked by other thread or checking if the record is exist, before locked a record, should be keep in synchronized block.
Hi Jesse I still have a question. Whar you realy mean by
Make sure that the process of checking if a record is locked by other thread or checking if the record is exist, before locked a record, should be keep in synchronized block.
You mean that the the isLock(int):boolean metohd must be keeped in to a synchronized block - synchronized with the same instance like lock(int) metod ? By lock(int) I mean the menthod that locks a record in the lock manager.
Thanks, Mihai. [ October 30, 2005: Message edited by: Mihai Radulescu ]