Distributed Objects and RMI
Distributed Objects and RMI
Object Server Server Proxy Runtime Support Network Support Physical Flow Logical Flow
maps the platform-independent stub/skeleton layer to the platform-dependent transport layer; carries out remote reference protocols sets up, maintains, and shuts down connections; and carries out the transport protocol
Object Registry
The RMI API allows a number of directory services to be used for registering a distributed object We will use a simple directory service called the RMI registry, rmiregistry, which is provided with the Java Software Development Kit (SDK) The RMI Registry is a service whose server, when active, runs on the object servers host machine, by convention and by default on the TCP port 1099 An alternative naming/directory service is Java Naming and Directory Interface (JNDI), which is more general than the RMI registry, in the sense that it can be used by applications that do not use the RMI API
receive return value marshal reply send reply unmarshall reply; return value
(based on http://java.sun.com.marketing/collateral/javarim.html)
from the Java Remote interface Other than the Remote extension and the Remote exception that must be specified with each method signature, a remote interface has the same syntax as a regular or local Java interface
interface to a distributed object Each object server must implement each of the remote methods specified in the interface register an object which contains the implementation with a directory service
Stub Generation
In RMI, each distributed object requires a proxy for the
object server and the object client This proxy is generated from the implementation of a remote interface using a tool provided with the Java SDK: the RMI compiler rmic
rmic v1.2 SomeImpl
The host name should be the name of the server, or simply localhost. The reference name is a name of your choice, and should be unique in the registry
where the port number is a TCP port number If no port number is specified, port number 1099 is assumed The registry will run continuously until it is shut down (via CTRL-C, for example)