aspose file tools*
The moose likes Distributed Java and the fly likes Object that is Serializable and remote Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Object that is Serializable and remote" Watch "Object that is Serializable and remote" New topic
Author

Object that is Serializable and remote

Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1066
I was reading RMI and came across this question:
If a Serializable object(implements java.io.Serializable) is passed as a parameter or a return value, then a copy of the object is sent from one address space to another. Similary, if a remote object(implements java.rmi.Remote) is passed, then a reference of the object is sent from one address to another.
What would be the case if the object implements both java.io.Serializable and java.rmi.Remote? Will a copy or a reference of the object be sent from one address to another? :roll:
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
A copy would be sent.
Serializable is what java looks for to see if it can bundle up the object and send it to a stream.
Your definition of remote is not exactly true. A remote object can certainly be passed if it also implements serializable, however, the Remote interface is really nothing more than a flag. To actually make much use of it, you must sub-class(interface) it. Only methods named in that sub-interface can be called remotely. There is never a "pass" made with an object that implements a Remote subinterface. The Object on the client end must have an existing, matching object on the server end to make a connection to.
The registry is the dating service of the RMI world. It takes in personals(Naming.rebind) from the server, waits for a client call(Naming.lookup) for the interface matching its rebind info, and puts them in touch with each other.
Ok, that got a bit wierd, but I hope it made sense. If it answered your question, all the better.
Any questions?
Chris
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1066
Thanks Chris. I got the concept...
Clement Low
Greenhorn

Joined: Jan 06, 2004
Posts: 1
Hi,

I just want to know if the following is true:

1) synchronisation methods will just the concurrency issues?
2) what u meant by thread-safe?
3) by passing a copy of the object to the client, if there is anything that the client needs to write to file, can i just get the information from that copy and ask my server to do the processing (am i right?)

I am getting a bit confused here.
Thanks
Clement
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
OK, i don't understand what you are trying to ask in either questions 1 or 2.
For 3, it depends on where you want the file written- on the client or on the server. wherever it is to be written, that entity probably do the processing based on the copy of the object that it has.

Chris
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Object that is Serializable and remote