User Tools

Site Tools


cs442_hw7

Write an RMI server that matches clients who are looking for matches.

The server should provide a single method: String match(String name, int timeoutSecs). The first parameter is the unique name of the client who wants to be matched. The second parameter is the time out value (how long the client can wait). The method returns the name of another client who is currently looking for matches. If a match cannot be found in timeoutSecs seconds, then the method should return null.

Once two clients get each others' names, they should get a remote reference to each other and wait for a handshake() call. Use the client name lexographical order to order the handshakes().

Here is an example order of events:

  • A asks the server for a match
  • B asks the server for a match
  • B's call returns with A's name
  • A's call returns with B's name
  • B waits for A's handshake
  • A sends a handshake to B
  • A waits for B's handshake
  • B sends a handshake to A

Extra points if your code does not include any sleep calls.

Note: I am attaching here code that illustrates how the server should work. This code does not use RMI, but provides necessary locking and waiting logic that will be executed on the server side. This should clarify many of the questions you have. Here.

cs442_hw7.txt · Last modified: 2012/11/27 16:29 by bgedik

Page Tools