Anne Thomas Manes wrote:
> The primary difference between RMI and SOAP is that RMI works using pass by
> reference, and SOAP works using pass by value. I discussed these differences
> lightly in my blog entry, "Web services are not distributed objects". See
> http://atmanes.blogspot.com/2005/03/web-services-are-not-distributed.html.
This is the mistake that most people make. The RMI programming model is always
pass by value. Those values can be remote references to other objects, but
nothing at all dictates that.
In the RMI implementation that is JRMP in the JDK, any Object that is exported
by UnicastRemoteObject.export(), and which is subsequently passed through an
RMI
call, will have the remote reference sent over the wire, instead of the object.
This can be convenient, but it has create more problems than it has solved, in
general.
In JERI, the Exporter interface replaces the activities of
UnicastRemoteObject.export(). When you want something to be accessible
remotely, you must export it with an Exporter.export() call, and use the
returned value as your argument to a method call.
Many people get confused by the automatic transport of remote objects by JRMP,
and also think that anything they pass to a remote method call should extend
UnicastRemoteObject. This is one of the things that can create the nightmarish
"fine grained" calls that people bring up here as arguments against "RMI" from
time to time.
The important thing to understand is that a remote object, in Java, is nothing
more than an object implementing the java.io.Serializable interface AND all the
interfaces that are java.rmi.Remote interfaces, and it has a bunch of "magic"
in
it to transfer the calls between JVMs. The important thing is that it is
java.io.Serializable. Any object that is Serializable, can be sent between
JVMs. Thus, if I define
public class MyDocument implements Serializable {
public String content;
... some other values ...
public MyDocument( String val ) {
content = val;
}
... some other methods ...
}
I can send this object across the network in any direction. What I'm sending
is
not a remote object, although I might use a remote object as the "interface" to
document transfer.
public interface DocumentAccess extends java.rmi.Remote {
public MyDocument exchange( MyDocument val ) throws IOException;
}
Thus, I can use a document based architecture, while having the JERI stack at
my
fingers to manage security, smart proxy based transfer optimizations (send the
current contents of the MyDocument object over with the proxy to eliminate a
round trip request), switch of transport protocols (use HTTP because there's a
firewall who's operators will only allow port 80 through) etc.
Gregg Wonderly
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/service-orientated-architecture/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/