Multiple-Person Bumper Car Ride: RMI

Modify your multiple-person bumper car program so that the coordinator class is registered (rmiregistry) on jubjub and called remotely from cheshire by the car threads and from queen by the rider threads. Eliminate the restriction that at most two cars can be on the bumping floor at any one time, that is, as many cars as are full of riders and ready to bump can enter the floor. Your coordinator can use whatever you want except for busy-waiting for its internal synchronization.

Your coordinator class will have the interface routines

getInLine(ID)
waitCarFull(ID)
takeAride(ID)
load(ID)
unload(ID)
called by the riders and cars. The bumper car is a separate class that is created multiple times. Ditto the rider class.

You will have to run your owm rmiregistry on a port number between 1024 and 65535 that you pick at random that nobody else in the class is using. Here is how to run the example we looked at in class with 7777 picked as the random port, the server on jubjub and the client on cheshire.

jubjub% javac Compute.java
jubjub% rmic ComputeServer
jubjub% rmiregistry 7777 &
[1] 22850
jubjub% java ComputeServer -Mjubjub:7777 &
[2] 22858
 server ComputeServer has been created on jubjub:7777
  and bound in the registry to the name ComputeServer
    .....
cheshire% java Client -Mjubjub:7777
Client: serverMachine=jubjub:7777, serverName=ComputeServer, numClients=3
 napTime=4, runTime=20
age=4025, Client 0 sending to server work:
Work from Client 0
a= -2.83809 0.00930895 -4.61518 -2.22758 3.58825
b= 3.73225 -2.23148 -1.82137 2.15583 2.77105
c= 0 0 0 0 0
   .....

You MUST clean up after yourself each time you logout! Points will be taken off for any rmiregistrys or any Coordinator servers that are left running on any machines. Use the ps command to see what you have running in the background and the kill command to get rid of processes before logging out. There are two versions of the command. Here are example uses of each version of ps and the kill command. Of course, replace janedoe with your login id.

jubjub% /usr/ucb/ps uxww
USER       PID %CPU %MEM   SZ  RSS TT       S    START  TIME COMMAND
janedoe   4282  3.3  5.6 3864 1724 ?        S   Feb 26 76:16 /home/janedoe/JDK_1.0.2/java/bin/../bin/sparc/java ParkServer -Mjubjub:5557
janedoe   2788  3.0  4.6 3620 1440 ?        S   Feb 25 72:26 /home/janedoe/JDK_1.0.2/java/bin/../bin/sparc/java sun.rmi.registry.RegistryI

jubjub% kill -9 4282 2788

jubjub% /usr/bin/ps -u janedoe
   PID TTY      TIME COMD
  4282 ?       76:26 java
  2788 ?       72:34 java

jubjub% kill -9 4282 2788
You can also try the following.
jubjub% /usr/ucb/ps uaxww | grep janedoe