Hello everybody, This were my notes: General Considerations(maximum = 58): 55 Documentation(maximum = 20): 20 GUI(maximum = 24): 24 Server(maximum = 53): 49 I’m more than happy with the results. I downloaded the assignment on January 14:th and took the written exam on February 11:th. Thank you all for been here and sharing your skills and experience! Enrico
Congrats Can u please put some light on your locking mechanism. Have u modified the signature of lock and unlock in Data.java and used client id. Did u used some locking mechanism at RemoteDataAccess object level also ? Pls write in detail. This will be a gr8 help Amit
Joined: Dec 14, 2001
Thank you, Amit. from my DesignChoices.htm /Enrico Modifying vs. Extending the Data class I actually did both. I decided to modify the Data class and added the method public DataInfo criteriaFind(String criteria) Because this method is needed in both local and network mode.
But the other two methods: public void lock(int record) public void unlock(int record) are just needed in network method, so here I decided to create a new class DataLockUnlock that extends Data class and overrides the lock and unlock methods in Data class.
So for local mode I use the Data class which has the methods lock – unlock, but without any code inside. For network mode, I use the DataLockUnlock which have the lock and unlock mechanism implemented. So in my suncertify.client.FlightByNightService class I can have the same calls: lock, read, modify, unlock in both local and network mode.
Lock and unlock
I used an ArrayList for the lock/unlock mechanism. In this list it is the recordNumber that identifies the record. I don’t synchronize the lock/unlock methods but the list itself. If the list is NOT already in synchronize mode then I check if the list already contains that recordNumber. If yes, then the application waits until it is released. If no, the recordNumber is added the list. So if three people or more are going to book the same flight, this will be the scenario. 1) one will lock the record in the list 2) one will be waiting in the synchronized block for the other to be finished; i.e. unlocked it 3) all others will be waiting that the lock on the list will be released
For lock(-1) I just looped through every record, got the number an added it to the list. I think this the only way to it, because you can’t be sure that even if it is only 24 records that the recordNumber will correspond to that. It can be for instance 586 or whatever. For unlock(-1) I just used the clear() method to remove all entries.
Congrats Enrico. Good score and good job. I was wondering about your packages how many did you have? and what where their names. I only had client, db, and help. I think I should have split my server apart form the db package. Mark
Hi, And thank you all for the congrats. My plans for the future is to start working again. I'm a contractor somewhere in Europe and this is really my lucky day, because I've got a new 6 months contract today as well. I'll think I go for the Architect exam later on, I just don't know when. For Mark and the question of packages: suncertify.client suncertify.client.gui suncertify.server suncertify.misc suncertify.db /Enrico