1 / 19

Java RMI

Java RMI. CS-328 Internet Programming. In the Good Old Days. Only local objects existed. My Machine. My Object. Today’s World. Network and Distributed Objects. My Machine. Remote Machine. Local Objects. Remote Objects. Why not just use sockets?. sockets programming is tedious

lenore
Download Presentation

Java RMI

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java RMI CS-328 Internet Programming

  2. In the Good Old Days... Only local objects existed My Machine My Object

  3. Today’s World... Network and Distributed Objects My Machine Remote Machine Local Objects Remote Objects

  4. Why not just use sockets? • sockets programming is tedious • error prone for implementing complex protocols • best left to “the experts”

  5. Java RMI allows... • provide user with a “thin client “ • allows good performance on lowend workstations • run server on high end hardware • maximize $ investment over many clients • server remote from client • Distributed network object

  6. What RMI is...and isn’t • Java only solution to the problem of distributed object computing • Unlike CORBA it is not language independent • Isn’t meant to replace CORBA • Good for java only solutions, not easy to integrate with legacy code

  7. What RMI is...and isn’t (cont.) • 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

  8. Architecture Client Server Stubs Skeletons Remote Reference Remote Reference Transport

  9. The General Idea • Instantiate an object on another machine • Invoke methods on the remote object

  10. The parts... • Client - user interface • Server - data source • Stubs • marshals argument data (serialization) • unmarshals results data (deserialization) • Skeletons (not reqd w/Java 2) • unmarshals argument data • marshals results data

  11. The parts... (cont.) • Remote Reference Layer • 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 • sets up and maintains connections • communications related error handling

  12. 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)

  13. To run • Start the RMI registry • rmiregistry is in the JSDK bib directory • Start the RMI Server • Start the RMI Client • let ‘er rip...

  14. 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

  15. RMI Registry (more) • Use another naming service • J2EE uses JNDI and Directory Services to provide a more robust naming service • Silverstream uses JNDI with its own ServiceProvider and repository for RMI

  16. 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

  17. Java Remote Method Protocol (JRMP) • 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 don’t use JRMP instead use their own wire level protocol

  18. Other JDK 1.1 and Java 2 Differences • With the Java 2 SDK • Service interfaces are not required to extend from java.rmi.Remote • Service methods do not necessarily throw RemoteException.

  19. Java 2 JSDK 1.3 • 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 • sets the direction for RMI/CORBA Integration • more on CORBA later

More Related