Ram Dhan Yadav (SCJP, SCWCD, SCJA-I, IBM EC(483))
"We are what we repeatedly do. Excellence, then, is not an act, but a habit."
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Ram Dhan Yadav K:
If an object implements java.rmi.Remote, can it be passed on the wire? or does it have to implement Serializable interface also?
Matjaz Juric<br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100544X/qid%3D1008676221/sr%3D8-1/ref%3Dsr%5F8%5F5%5F1/103-4928879-8274265" target="_blank" rel="nofollow">Professional J2EE EAI</a> and <a href="http://www.amazon.com/exec/obidos/ASIN/1861005083/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional EJB</a>
Ram Dhan Yadav (SCJP, SCWCD, SCJA-I, IBM EC(483))
"We are what we repeatedly do. Excellence, then, is not an act, but a habit."
Originally posted by Ram Dhan Yadav K:
Why can't a single class cannot implement both interfaces? Its perfectly legal to implement more than one interface in java right? What are the problems faced with this?
Matjaz Juric<br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100544X/qid%3D1008676221/sr%3D8-1/ref%3Dsr%5F8%5F5%5F1/103-4928879-8274265" target="_blank" rel="nofollow">Professional J2EE EAI</a> and <a href="http://www.amazon.com/exec/obidos/ASIN/1861005083/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional EJB</a>
Ram Dhan Yadav (SCJP, SCWCD, SCJA-I, IBM EC(483))
"We are what we repeatedly do. Excellence, then, is not an act, but a habit."
If a class implements Remote interface, objects cannot be sent over the wire by value. Rather references are sent. To send the object by value, the class has to implement the Serializable interface.
However, a single class cannot implement both interfaces.
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Thomas Paul:
This is incorrect. Look at the RemoteObject class which is in the package java.rmi.server:
http://java.sun.com/j2se/1.3/docs/api/java/rmi/server/RemoteObject.html
It implements both Remote and Serializable.
Matjaz Juric<br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100544X/qid%3D1008676221/sr%3D8-1/ref%3Dsr%5F8%5F5%5F1/103-4928879-8274265" target="_blank" rel="nofollow">Professional J2EE EAI</a> and <a href="http://www.amazon.com/exec/obidos/ASIN/1861005083/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional EJB</a>
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Matjaz Juric:
If a class implements Remote interface, objects cannot be sent over the wire by value. Rather references are sent. To send the object by value, the class has to implement the Serializable interface.
However, a single class cannot implement both interfaces.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep
Originally posted by Thomas Paul:
I got a clean compile and a clean rmic on this:
Matjaz Juric<br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100544X/qid%3D1008676221/sr%3D8-1/ref%3Dsr%5F8%5F5%5F1/103-4928879-8274265" target="_blank" rel="nofollow">Professional J2EE EAI</a> and <a href="http://www.amazon.com/exec/obidos/ASIN/1861005083/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional EJB</a>
Originally posted by Doug Wang:
What if a Remote object itself acts as a parameter to pass across machines?
Matjaz Juric<br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100544X/qid%3D1008676221/sr%3D8-1/ref%3Dsr%5F8%5F5%5F1/103-4928879-8274265" target="_blank" rel="nofollow">Professional J2EE EAI</a> and <a href="http://www.amazon.com/exec/obidos/ASIN/1861005083/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional EJB</a>
It would appear that this can only work if the client has access to the remote object class itself and not just the remote interface. Perhaps that is why Serializable/Remote is used in the java.rmi.server package?Originally posted by Matjaz Juric:
I think our discussion is getting very interesting. I’ve tried what you’ve recommended, however if I remove the Wire interface, how can the Client (which can be located on a remote computer, and therefore does not have access to WireImpl – it should only have access to the interface of the remote object, not its implementation) get the Hello object?
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Originally posted by Thomas Paul:
It would appear that this can only work if the client has access to the remote object class itself and not just the remote interface. Perhaps that is why Serializable/Remote is used in the java.rmi.server package?
Matjaz Juric<br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100544X/qid%3D1008676221/sr%3D8-1/ref%3Dsr%5F8%5F5%5F1/103-4928879-8274265" target="_blank" rel="nofollow">Professional J2EE EAI</a> and <a href="http://www.amazon.com/exec/obidos/ASIN/1861005083/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional EJB</a>
Originally posted by Rajeev Gupta:
As far as it concern with implementing both the interface, The Virtual machine will have a problem as to transffer an object with what techinque(Serialization or Remote).
Matjaz Juric<br />Author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100544X/qid%3D1008676221/sr%3D8-1/ref%3Dsr%5F8%5F5%5F1/103-4928879-8274265" target="_blank" rel="nofollow">Professional J2EE EAI</a> and <a href="http://www.amazon.com/exec/obidos/ASIN/1861005083/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional EJB</a>
Men call me Jim. Women look past me to this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|