A Short Java RMI Tutorial

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    A Short Java RMI Tutorial - Presentation Transcript

    1. A Short Java RMI Tutorial Albert Guo [email_address]
    2. Agenda
      • Introducing RMI
      • The RMI classes and interfaces
      • The General RMI Architecture
      • Demo – build up 4 required classes
      • Demo – compiling and running the Weather Server
    3. Introducing RMI
      • An RMI application is often composed of two separate programs, a server and a client. The server creates remotes objects and makes references to those objects accessible. Then it waits for clients to invoke methods on the objects. The client gets remote references to remote objects in the server and invokes methods on those remote objects.
      • Users use object as though it were a regular, local object
        • Network connections happen automatically behind the scenes
        • Java ‘serialization’ lets you pass complex data structures over the network without writing code to parse and reconstruct them
    4. Introducing RMI (cont.)
      • A distributed object application has to handle the following properties:
        • Locate remote objects
        • Communicate with remote objects
        • Load class bytecodes for objects that are passed as parameters or return values
    5. Interfaces and Classes in the java.rmi package
    6. The RMI classes and interfaces
    7. The General RMI Architecture
    8. Remote object interface implemenation
    9. RMI Architecture
    10. Runtime Architecture
    11. Stub and Skeleton
      • Package identifier of remote object
      • Package method identifier
      • Marshall parameters
      • Send package to server skeleton
      • Unmarshall parameters
      • Calls return value or exception
      • Marshall method return
      • Send package to client stub
      • Stub Operation
      • Skeleton Operation
    12. Demo – build up 4 required classes
    13. Class Diagram – four required classes 1 2 3 4
    14. The interface for remote object
      • The remote interface must satisfy the following conditions:
      • It must extend the interface Remote.
      • Each remote method declaration in the remote interface must throw RemoteException
    15. The remote object implementation
      • The class must extend UnicastRemoteObject and implement the remote object interface
      • The constructor should throw RemoteException
    16. The remote object implementation
    17. The RMI Server
      • The server builds an object and register it with a particular URL
      • Using Naming.bind(throw AlreadyBoundException if a previous binding exists) or Naming.rebuind (replace any previous bindings)
    18. The RMI Client
      • Lookup the object from the host using Naming.lookup, cast it to any appropriate type, then use it like a local object
    19. The RMI Client
    20. Demo – compiling and running the Weather Server
    21. Compiling and running the Weather Server
      • 1. generate the client stub and server Skelton
      • 2. startup the RMI registry
    22. Compiling and running the Weather Server
      • 3. startup the server
      • 4. start the client
    SlideShare Zeitgeist 2009

    + Guo AlbertGuo Albert Nominate

    custom

    3386 views, 1 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 3386
      • 3386 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 77
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Tags