1 / 16

JAVA REMOTE METHOD INVOCATION (RMI)

JAVA REMOTE METHOD INVOCATION (RMI). FONG CHAN SING (143334) WONG YEW JOON (143388). What is JAVA RMI?. JAVA RMI is a distributive system programming interface introduced in JDK 1.1 .

wiley
Télécharger la présentation

JAVA REMOTE METHOD INVOCATION (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 REMOTE METHOD INVOCATION (RMI) FONG CHAN SING (143334) WONG YEW JOON (143388)

  2. What is JAVA RMI? • JAVA RMI is a distributive system programming interface introduced in JDK 1.1. • A library that allows an object running in one Java virtual machine to invoke methods on an object running in another Java virtual machine. • Similar to RPC but is more simpler and written in JAVA language. • Can only be used between JAVA programs.

  3. JAVA RMI CONCEPT • The server must first bind it name to the registry. • The client lookup the server name in the registry to establish remote references. • The stub (client side) serializing the parameters to skeleton, the skeleton (server side) invoking the remote method and serializing the result back to the stub.

  4. A client invoke a remote method, the call is first forwarded to stub. • The stub is responsible for sending the remote call over to the server-side skeleton. • The stub opening a socket to the remote server, marshaling the object parameters and forwarding the data stream to the skeleton. • A skeleton contains a method that receives the remote calls, unmarshals the parameters, and invokes the actual remote object implementation.

  5. JAVA RMI ARCHITECTURE • The stubforward request and receives the result. • The skeleton responsible to receiving the request and forward the result. • Remote Reference Layer (RRL) responsible for carrying out a specific remote reference protocol. • Transport Layer responsible for connection set up and reporting object tracking.

  6. TOOLS NEEDED FOR JAVA RMI • Must have: • JDK 1.1 or above • rmiregistry – remote object registry service • rmic – generate stubs and skeletons for remote object(Below JAVA version 5) • rmid - RMI activation system daemon • serialver - return class serialVersionUID • Optional: • Textpad

  7. COMPONENT OF JAVA RMI • Generally, JAVA RMI consists of: • RMI Interface • RMI Server • RMI Client How it JAVA RMI works?

  8. STEPS FOR DEVELOPING JAVA RMI SYSTEM • Define the remote interface. • Develop the remote object by implementing the remote interface. • Develop the client program. • Compile the JAVA source files. • Generate the client stubs and server skeleton. • Start the RMI regisitry. • Start the remote object server. • Run the client.

  9. RMI INTERFACE • A RMI interface is an interface that declares a set of methods that maybe invoked from a remote JAVA virtual machine. • Requirement: • Must extended java.rmi.Remote • Each method must declare java.rmi.RemoteException

  10. RMI SERVER • UnicastRemoteObject - classes that remote object implementations can extend which facilitate remote object creation. • super() calls the following superclass constructor: • UnicastRemoteObject() Creates and exports a new UnicastRemoteObject object using an anonymous port. • exportObject(Remoteobj) Exports the remote object to make it available to receive incoming calls using an anonymous port.

  11. RMI SERVER

  12. RMI SERVER • The Naming class provides methods for storing and obtaining references to remote objects in a remote object registry: rebind(String name, Remoteobj) • Rebinds the specified name to a new remote object.

  13. RMI CLIENT • lookup(String name) • Returns a reference, a stub, for the remote object associated with the specified name. //host:port/name • where host is the host (remote or local) • where the registry is located- default is localhost • port is the port number on which the registry accepts calls- default is 1099 • Client can using remote object method through stub.

  14. RMI CLIENT

  15. After developing the code for RMI interface, RMI server, RMI client. Compile all of them. • Next, using command line and go to the directory on when user store all this code. At there, type start rmiregistry • Then, run the server code. • Run the client code.

  16. DEMOSTRATION SESSION

More Related