COMP 310
Fall 2014

HW07: Remote task execution

Home  Info  Owlspace   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 correctlyu.
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 package, including its controller, view and model.   You can start by simply copying the existing client 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!

Note that the provided.compute package contains all the interfaces that BOTH the client and the server need to talk to each other.

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.  - 15 pts
  3. The task must display some sort of status message on the server when it is run.  - 15 pts
  4. The task should run properly when both the client and server are on the same machine.  - 15 pts
  5. The task should run properly when the client and server are on different machines.   Test this between your and your partner's machines! - 25 pts

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


© 2014 by Stephen Wong