I had a few questions, 1) On the lock and unlock do any of you guys think it is necessary to have a read lock and a write lock separetely? If so, did you guys implement both in the lock method or did you guys have separate methods for them? The data class given to us, just has a lock and unlock method to be implemented. 2)Did you guys have a separate sub-class for the lock and unlock? I am thinking of having one. Just needed a second opinion. 3) I need to make a reference to the current thread while using the write lock and unlock methods. I am using RMI, and would like to know if should be a problem. Would RMI remember the threads associated with each client?
posted 14 years ago
hello Prakash. my opinions on these questions - it's not necessary at all a read lock, and actually it is pointed in the assigment
Note that the locking required is effectively a "write" lock only.
- you can implement the lock in your Data class if you wish, but in my opinion that will not help to the clear definition of Data responsabilities. also as locking systems can be implemented in different ways, an independent class for the lock implementation will help to leave the system open for enhancements - with rmi you can't be sure the same thread will run always on the same client, so tracking the clients with threads is not a good idea
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads