hi, I've get the project several days,but I'still cannot kown how to implement the non-network/network.And I want to make the project with rmi.So,should I create LocalDataAcess.class and RemoteDataAcess seperatley to implement the local and remote ,or all use the RemoteDataAcess.class.
I would do two classes... you should be doing different things for the different modes. The requirements say that no sockets should be opened in local mode.
thanks,another problem,there are some methods in the Data.class which is sychronized.When I implement those methods in my class RemoteData.class,could I plus 'synchronized'? (I use rmi)
"Ray"- Welcome to the JavaRanch! Please adjust your displayed name to meet the JavaRanch Naming Policy. You can change it here. Thanks! and welcome to the JavaRanch! Mark
Well in remote mode your proxy object is just passing alls to the Data class, so therefore you do not need to include the Synchronized keyword. Plus each proxy object is only for one client each, so there is no synchronization issues. Mark
Ray Cheeny
Ranch Hand
Joined: Aug 21, 2002
Posts: 74
posted
0
In the Data.java ,there are some synchronized methods.Do you mean if I want to use those methods in my class which extends UnicastRemoteObject,I should delete the 'synchronized'.But i wonder that is that threadsafe? Another question,should I implement the lock/unlock in my local design?
Since the Data methods are threadsafe, i.e. synchronized, and you will presumably be calling those method thru your remote implementation then there is no need to synchronize the methods in the remote implementation to maintain thread safety. Hope this helps, Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher