CC5212-1 Procesamiento Masivo de Datos Otoño 2016 Lab 2: Aidan Hogan's Message

Slide Note
Embed
Share

In this lab project, Aidan Hogan provides instructions for accessing a code repository and implementing an instant messaging system. The steps include logging in, connecting to a directory, implementing message servers and apps, and setting up the command line to message peers. Detailed visuals accompany each step to guide the process effectively.


Uploaded on Dec 06, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. CC5212-1 PROCESAMIENTO MASIVO DE DATOS OTO O 2016 Lab 2: Mensaje Aidan Hogan aidhog@gmail.com

  2. Step 1: Get Started Login: Username: nombre/cc5212 Password on board Get code and import into Eclipse: http://aidanhogan.com/teaching/cc5212-1-2016/02/mdp-lab-02.zip File > Import >

  3. Step 2: Connect to Directory I start the directory! Will put details on the board Connect org.mdp.cli.UserDirectoryClientApp

  4. Step 3: Implement Message Server org.mdp.im.InstantMessagingServer Implement InstantMessagingStub Write message(.,.) method Print the message to the console and whom it s from

  5. Step 4: Implement Message App. org.mdp.cli.InstantMessagingApp Server (receive) Client (send)

  6. Step 4a: Start Registry org.mdp.cli.InstantMessagingApp Implement startRegistry(.) Server (receive) Client (send) Registry (port)

  7. Step 4b: Register Skeleton org.mdp.cli.InstantMessagingApp Implement bindSkeleton(.) key = InstantMessagingServer Aka. InstantMessagingServer.class.getSimpleName(); skeleton = new InstantMessagingServer() Server (receive) Client (send) Registry (port) key skeleton

  8. Step 4c: Implement Client org.mdp.cli.InstantMessagingApp messageUser(.,.,.) Connect to remote registry Get the stub from the registry (same key) Message user! Directory 172.17.69.YYY localhost Server (receive) Client (send) Registry (port) key skeleton

  9. Step 4d: Find Peers w/ Directory org.mdp.cli.InstantMessagingApp connectToDirectory() 172.17.69.XXX Directory 172.17.69.YYY localhost Server (receive) Client (send) Registry (port) key skeleton

  10. Step 4e: Setup Command Line Run InstantMessagingApp With argument: -n [dir-location] Add yourself Message classmates!

  11. JAVA RMI OVERVIEW

  12. Why is Java RMI Important? We can use it to quickly build distributed systems using some standard Java skills.

  13. What is Java RMI? RMI = Remote Method Invocation Remote Procedure Call (RPC) for Java Predecessor of CORBA (in Java) Stub / Skeleton model (TCP/IP) Client Server Network Skeleton Stub

  14. What is Java RMI? Stub (Client): Sends request to skeleton: marshalls/serialises and transfers arguments Skeleton (Server): Passes call from stub onto the server implementation Passes the response back to the stub Demarshalls/deserialises response and ends call Client Server Network Skeleton Stub

  15. Stub/Skeleton Same Interface! Client Server

  16. Server Implements Skeleton Problem? Synchronisation: (e.g., should use ConcurrentHashMap) [Thanks to Tomas Vera ] Server

  17. Server Registry Server (typically) has a Registry: a Map Adds skeleton implementations with key (a string) Server Registry sk3 SkelImpl3 sk2 SkelImpl2 sk1 SkelImpl1

  18. Server Creates/Connects to Registry OR Server

  19. Server Registers Skeleton Implementation As a Stub Server

  20. Client Connecting to Registry Client connects to registry (port, hostname/IP)! Retrieves skeleton/stub with key Server Network Registry Client sk2 sk3 SkelImpl3 sk2 SkelImpl2 SkelImpl2 Stub2 sk1 SkelImpl1

  21. Client Connecting to Registry Client

  22. Client Calls Remote Methods Client has stub, calls method, serialises arguments Server does processing Server returns answer; client deserialises result Network Client Server concat ( a , b ) Stub2 SkelImpl2 ab

  23. Client Calls Remote Methods Client

  24. Java RMI: Remember 1. Remote calls are pass-by-value, not pass-by- reference (objects not modified directly) 2. Everything passed and returned must be Serialisable (implement Serializable) 3. Every stub/skel method must throw a remote exception (throwsRemoteException) 4. Server implementation can only throw RemoteException

More Related Content