COMP 310
Spring 201
7

HW07: Remote task execution

Home  Info  Canvas   Java Resources  Eclipse Resources  Piazza

Today's example has a "compute engine" (ICompute) on the server  which is served out as a remote object.   The client then sends a "compute task" (ITask) to the server for it to execute, returning the result to the client.   The key issue here is that the server does not know a priori what the client will have it do

Before starting this assignment, be sure that you can run the demo from Lab08, which includes configuring your computer for use with RMI.

This assignment, and all future assignments will use TCP ports in the ranges: 2001-2002 and 2099-2102.

References:

Obtaining and Runnning the demo

The code is available by setting the svn:externals property (under Team/Set Property) of your src folder to "provided https://svn.rice.edu/r/comp310/course/ComputeEngine/provided"

Be sure to set the working directory of both the client and server launch configurations to your the "bin" directory in your project.  
Also, set both the client and engine (server) launch configurations to be "shared" so that they will always be set correctly.
See the Eclipse Resources page for directions  

Ports that need to be opened (see the code for the values):

 

Click for full-size image
Compute Engine

Features

Read the documentation!

 

Important concepts:

Stubs retrieved from remote Registries -- The ICompute stub that the client retrieves via the Registry delegates its calls back to its ComputeEngine implementation on the server.

Stubs sent and returned by stubs  (stubs as factories) -- IRemoteTaskViewAdapter stubs are both sent to the server via a method in the ICompute stub in the client as well as returned by the ICompute stub as a return value.  Thus a single stub can serve as a factory for all the other stubs that are needed, eliminating the need for multitudes of objects bound in the Registry--only a single factory needs to be bound.

Entire objects being serialized and sent via stubs -- the ITask objects are being completely serialized and sent over the network from the client to the server.  They are not sent as stubs.  

Automatic remote dynamic class loading of serialized objects -- If the server does not have the code for the concrete ITask sent to it, the RMI system settings that the client and server set up automatically cause the code for the task to be dynamically loaded from across the network, from the client's class server to the server.  Likewise, this is done for the stubs that are sent back and forth.

Requirements:

You will need to create your OWN client and engine packages, including their own controller, view and model sub-packages.   You can start by simply copying the provided client and engine package code to your own packages (be sure to rename the package internally!) and modifying from there.  

You may NOT change any of the provided code -- you will receive a commit error if you do so!

Functionality of the provided code:

As given, the provided code is fully functional in these aspects:

  1. The client is capable of connecting to the compute engine.  But, upon initial connection
    1. No verification on the client of the succesful reception of the IRemoteTaskViewAdapter stub from the engine.
    2. No connection verification message sent from client to the engine upon initial connection.
    3. No connection verification message sent from the engine to the client upon initial connection.
  2. The Pi2 and GetInfo tasks can be sent from the client to engine and are executed and their results displayed both on the engine and the client.
    1. Internal status messages generated during the task's execution (i.e. inside of the task's execute method) are displayed on the compute engine's view.
  3. The client's Send msg to remote host's view text field will NOT send the given string message to a connected compute engine's view because the client is missing the stub to do so.
  4. The compute engines's Send msg to remote client's view text field will NOT send the given string message to a connected client's view because the engine is missing the stub to do so.

 

There are 4 locations in the provided code where the student must implement missing code in their copies (Search the project for "STUDENT TODO") :     

  1. client.model.ClientModel:
  2. engine.model.ComputeEngine

There are directions in the code as to what needs to be inserted in each location.  Multiple lines of code may need to be inserted.    Correct implementation of the missing code will result in the fixing all of the missing functionality listed above.

Student work:

Note that the provided.compute package contains all the interfaces that BOTH the client and the server need to talk to each other.   Do NOT copy or modify this package!

Testing

Testing RMI programs can be tricky.   You can easily be fooled into thinking that your code runs properly if you test insufficiently.   In particular, if both ends of your test contain all the code, the remote dynamic class loading will not be tested.  Here's a more complete test:

Most Common Errors

 

Grading Guidelines

  1. The tasks must return a value whose type is NOT BigDecimal.   The tasks should return at least 2 different types of results.   - 30 pts
  2. The tasks' results should be displayed on the client and engine's views.  - 5 pts
  3. The task execution must display some sort of status message on the server when it is run.   That is, the task's execute method should utilize the ILocalTaskViewAdapter given to it by the compute engine to display a status message. - 5 pts
  4. Stub properly created from ClientModel.clientTVA RMI server instance. - 5 pts
  5. ComputeEngine.remoteTaskViewAdpt RMI server instance properly implemented as per Javadocs in code. - 5 pts
  6. Stub properly created from ComputeEngine.remoteTaskViewAdpt RMI server instance.- 5 pts
  7. Upon intial connection, client view shows verification of successful reception of engine's IRemoteTaskViewAdapter stub and successfully sends verfication message to engine using that stub. - 5 pts
  8. Upon initial connection, compute engine's view shows verification of successful reception of clients's IRemoteTaskViewAdapter stub and successfully sends verfication message to client using that stub. - 5 pts
  9. Able to send string message from client's view to connected compute engine's view. - 5 pts
  10. Able to send string message from compute engine's view to connected client's view.- 5 pts
  11. The task should run properly when both the client and server are on the same machine.  - 5 pts
  12. The task should run properly when the client and server are on different machines.   Test this between your and your partner's machines! Your code will be tested against a course staff machine. - 5 pts
  13. List, in your Readme.txt file, the NetID's of 10 people (individuals, not groups) with whom you have successfully tested both your client and computer engine (i.e. can successfully send and process all tasks).    You must test with that person's personal computer, i.e. in the end, you must have tested against at least 10 different computers.   Different people in the same group do count as separate individuals, except one's own partner(s) which are to be tested as part of #12 above.  - 10 pts
  14. Run configurations created and saved in repository for both client and compute engine. - 5 pts

Note that the above requirements mean that you cannot change anything in provided.compute package!


© 2017 by Stephen Wong