Unformatted text preview:

Slide 1RMIWarningJava and the WebRemote Method InvocationSerializable objectsRemote ReferencesParts in a RMI SystemRMI processRMI Server, Client, and RegistryStub ClassStub Class ResponsibilitiesSkeleton ClassRemote Reference LayerRemote Reference Layer (2)Remote Reference Layer (3)Remote Reference Layer (4)RMI RegistryParameter PassingParameter MarshallingBuilding RMI ApplicationsA Distributed Hello World Program Using RMISteps InvolvedSource FilesThe Remote InterfaceRemote InterfaceThe Implementation ClassThe Implementation Class (Cont’d)Server Code (1)Server Code (2)Server Code (3) main beginsServer Code (4) main endsNotes on Server CodeNotes on Server Code (contd)Slide 35A Remote Service AppletRemote Applet Code (2)Remote Applet Code (3)Notes on Client AppletThe Web Page (hello.html)Compiling the Java Source CodeGenerate Stubs and SkeletonsJava 2 SDK StubsDeploying Applet (1)Sample Policy File for User (.java.policy) in $HOMESecurity PolicyStart the Remote Object RegistryStarting the ServerSlide 49Slide 50Common ExceptionRunning the AppletOutputAdvantages of RMIRMI LimitationsSummaryDefining InterfacesCreating Classes that Implement the InterfacesInterface Class Example (1)Interface Class Example (2)Interface Class Example (3)Interface Class Example (4)Interface Class Example (5)Slide 64Slide 65Trouble ShootingProblems EncounteredSlide 68HintsLessons LearnedEnvironment ConflictsGood RMI explanationRMI VersionsSlide 74George BlankUniversity LecturerRMIIntroduction to RMIWarning•This course is very volatile. Software is upgraded every semester. You should not assume that an example in the presentation is complete, or that it will work in the present environment. It is best to get your code examples from the Sun Java tutorials and modify them to work. Use the lectures to understand the general principles.Java and the Web•Java’s popularity is due to its suitability for use on the World Wide Web (WWW).•Several Web browsers have support for Java:–Netscape Navigator–Internet Explorer–HotJava•Java incorporates audio, video, and animation directly on the web page.Remote Method Invocation•RMI provides the means to invoke methods remotely.•RMI allows for applications to communicate and execute across multiple systems on a network.•RMI is supported by the java.rmi, java.rmi.server, and java.rmi.registry•Enhanced security of Java 2 requires a security policy implementation.Serializable objects•For a parameter to be passed remotely in Java, it must be serializable. This means that it must be capable of being packaged in a form that can be marshaled and unmarshaled. Marchaling is the process of packaging information so that it can be passed over a connection without errors due to any differences in the client and server environments.Remote References•A remote reference needs a network address and endpoint f a server plus a local reference for the actual object to be addressed, used only by the server. The remote reference is built from two classes, a server class on the server side and a client class on the client side.•See explanation in Tanenbaum and van Steen, page 97.Parts in a RMI System•Interface definitions for remote services •Implementations of the remote services •Stub and Skeleton files •A server to host the remote services •An RMI Naming service that allows clients to find the remote services •A class file provider (an HTTP or FTP server)RMI processJava Client Java ServerClient Stub Server SkeletonClient MethodCalled MethodNetwork transport Network Transportarguments resultsNetworkNot neededIn Java 2RMI Server, Client, and Registry•The server process registers the remote object X with the registry using the Naming.bind() method.•The client calls Naming.lookup(), which contacts the registry and obtains a stub object for X.•The client then uses the stub as if it is a local object.Stub Class•A stub for a remote object is the client-side proxy for the remote object. Such a stub implements all the interfaces that are supported by the remote object implementation. The client-side stub responsibilities are shown on the next slide.Stub Class Responsibilities•Initiating a call to the remote object (by calling the remote reference layer).•Marshaling arguments to a marshal stream (obtained from the remote reference layer).•Informing the remote reference layer that the call should be invoked.•Unmarshaling the return value or exception from a marshal stream.•Informing the remote reference layer that the call is complete.Skeleton Class•A skeleton for a remote object is a server-side entity that contains a method which dispatches calls to the actual remote object implementation. The skeleton is responsible for:–Unmarshaling arguments from the marshal stream.–Making the up-call to the actual remote object implementation. –Marshaling the return value of the call or an exception (if one occurred) onto the marshal stream.Remote Reference Layer•The remote reference layer deals with the lower level transport interface and is responsible for carrying out a specific remote reference protocol which is independent of the client stubs and server skeletons. The remote reference layer has two cooperating components: the client-side and the server-side components.Remote Reference Layer (2)•The client-side component contains information specific to the remote server (or servers, if the remote reference is to a replicated object) and communicates via the transport to the server-side component. During each method invocation, the client and server-side components perform the specific remote reference semantics.Remote Reference Layer (3)•For example, if a remote object is part of a replicated object, the client-side component can forward the invocation to each replica rather than just a single remote object.•In a corresponding manner, the server-side component implements the specific remote reference semantics prior to delivering a remote method invocation to the skeleton.Remote Reference Layer (4)•For example, the server side could handle ensuring atomic multiple delivery by communicating with other servers in the replica group.The remote reference layer transmits data to the transport layer via the abstraction of a stream-oriented connection. The transport takes care of the implementation details of connections. Although connections present a streams-based interface, a connectionless transport may be implemented beneath the


View Full Document

NJIT CS 602 - Introduction to RMI

Download Introduction to RMI
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Introduction to RMI and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Introduction to RMI 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?