Java remote method invocation: Difference between revisions

Content deleted Content added
Bluelinking 1 books for verifiability.) #IABot (v2.1alpha3
Mhaeusser (talk | contribs)
m Removed unnecessary spaces, removed "public" from interface method.
Line 20:
The following classes implement a simple client-server program using RMI that displays a message.
 
'''<code>RmiServer </code> class''' &mdash; listens to RMI requests and implements the interface which is used by the client to invoke remote methods.
 
<source lang=java>
Line 31:
 
public RmiServer() throws RemoteException {
super(0); // required to avoid the 'rmic' step, see below
}
 
Line 60:
</source>
 
'''<code>RmiServerIntf </code> interface''' — defines the interface that is used by the client and implemented by the server.
 
<source lang=java>
Line 67:
 
public interface RmiServerIntf extends Remote {
public String getMessage() throws RemoteException;
}
</source>
 
'''<code>RmiClient </code> class''' &mdash; this is the client which gets the reference (a proxy) to the remote object living on the server and invokes its method to get a message. If the server object implemented java.io.Serializable instead of java.rmi.Remote, it would be serialized and passed to the client as a value.<ref>[http://www.javaworld.com/javaworld/jw-11-2000/jw-1110-smartproxy.html Get smart with proxies and RMI - JavaWorld]</ref>
 
<source lang=java>