aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes confusion fo local&network Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "confusion fo local&network" Watch "confusion fo local&network" New topic
Author

confusion fo local&network

Ray Cheeny
Ranch Hand

Joined: Aug 21, 2002
Posts: 74
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.
Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
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.


scwcd, scjd, scjp<br /><a href="http://natejohnson.us" target="_blank" rel="nofollow">http://natejohnson.us</a><br /><a href="http://rice.kuali.org" target="_blank" rel="nofollow">http://rice.kuali.org</a>
Ray Cheeny
Ranch Hand

Joined: Aug 21, 2002
Posts: 74
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)
Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
I am not sure that I understand your question
Ray Cheeny
Ranch Hand

Joined: Aug 21, 2002
Posts: 74
sorry,i mean could i write like that:

Could i use synchronized here?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

"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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

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
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?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Ray,

... But i wonder that is that threadsafe?

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
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

Michael my translator.
Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: confusion fo local&network