Java RMI: CS-328 Internet Programming
Java RMI: CS-328 Internet Programming
My Machine
My Object
Todays World...
Network and Distributed Objects
sockets programming is tedious error prone for implementing complex protocols best left to the experts
Java only solution to the problem of distributed object computing Unlike CORBA it is not language independent Isnt meant to replace CORBA Good for java only solutions, not easy to integrate with legacy code
underlying wire protocol (object serialization) is not an open standard; the good news is that since JDK 1.2 it will optionally use the IIOP Protocol (RMI Over IIOP) Since it is a Java only solution objects are at the mercy of the java interpreter and JITs for run time performance
Architecture
Client Server
Stubs
Skeletons
Remote Reference
The parts...
provides a RemoteRef object that represents the link to the remote service implementation object. encodes and decodes the on-wire protocol implements the remote object protocols
Transport layer
The Transport Layer makes the connection between JVMs. All connections are stream-based network connections that use TCP/IP. handles the underlying socket handling required for communications
The steps...
Create the Interface to the server Create the Server Create the Client Compile the Interface (javac) Compile the Server (javac) Compile the Client (javac) Generate Stubs and Skeletons (rmic)
To run
Start the RMI Server Start the RMI Client let er rip...
RMI Registry
The RMI Registry is a naming service provided with the JDK as a teaching tool or for a small number of Remote Objects Uses port 1099 as its default port Can be considered to be a reference implementation runs out of steam above a 100 objects runs on same machine as the remote object
Activatable Objects
Added in Java 2 SDK Standard RMI objects exported as UnicastRemoteObject must run continuously instead by implementing java.rmi.activation.Activatable the object can be deactivated and reactivated remotely when a method call is made Must use the rmid server process to take advantage of this capability
Proprietary, stream-based protocol that is only partially specified is now in two versions
JDK 1.1 version of RMI and required the use of Skeleton classes on the server Java 2 SDK. It has been optimized for performance and does not require skeleton classes
some implementations, such as BEA Weblogic and NinjaRMI dont use JRMP instead use their own wire level protocol
RMI-IIOP
instead of using JRMP RMI will use Internet Inter-Orb Protocol (IIOP) IIOP is the wire protocol used for communication between Common Object Request Broker Architecture (CORBA) clients and servers CORBA is a distributed object technology from the Object Management Group (OMG)
800 member industry group vendor neutral architecture more on CORBA later