Hi all,
First let me sketch you the basics of my design, then I will have some questions.
I have a DataInterface that defines the methods to be implemented by the Data class (original from the assignment) and RemoteData class (the RemoteObject, extends UnicastRemoteObject, implements RemoteDataInterface, which in turn extends Remote and DataInterface).
My 'server' is the main method of RemoteData with the following code :
The instance of RemoteData bound to the RMI registry has an instance variable which is a Data object and also a LockManager instance.
My LockManager is a class that basically contains a HashMap for tracking associations between (client - record locked). As client ID in the LockManager, the RemoteData object uses itself (read 'this'). Is this correct ? (I feel not ...)
Now for the client : it acquires its DataInterface object like this :
which returns in db a DataInterface object. If operatingMode is local, then a simple Data object is created, if operatingMode is remote, then the factory does a lookup on RMI if no RemoteObject is already associated to the requesting client.
I hope everything is clear, because this is really difficult to put on paper. Don't hesitate to ask for clarifications if needed to answer my questions .... which are coming just now :
1. Do you see any major design problem ?
2. Is my locking mechanism correct ? In particular, will the client id chosen be a good choice ? (I didn't
test it on several machines yet)
3. If I want to track client losses, I read in many posts that a different instance of RemoteData should be returned to each client, which is not the case in here. Would you recommend changing my whole design, or just forget about the client loss problem ?
Thanks in advance for any help or comment on my design, as I am in a phase now where I wonder about each one of my choices
Stephane