This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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.
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
Joined: Aug 21, 2002
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