Are we allow to modify the lock(int) and the unlock(int) methods at all. For example I wanted to change lock and unlock to: void lock(int i, Object o) void unlock(int i, Object o) The reason for this is that I was planning on implementing the locking mechanism as a static inner class of the Data object. I also wanted to keep track of who was locking each of the records and the Object o allows me to have each data object when calling lock or unlock use 'this' as a parameter. Thanks for your help is advance!
The answer is yes, you are allow to modify anything you want, as long as you can justify the changes you made. As far as the tracking client part, you should take a look at other posts in regard to this topic. Personally, I don't think it's neccessary to track clients anyway.
posted 19 years ago
Yeah I was looking at a number of the other responses with regards to the locking mechanism. I think that the only way to do is to track who has which record locked. If the ArrayList, or Array or whatever you choose to implement is a static object in the Data class, such that the same locking array is accessed by each instance of the Data object. Then you have to keep track of which client has which data record locked. But thanks for your quick response.