SE 552: Homework

Deadline: 5.30pm, Wednesday 1 June 2004.

Last homework!


This week's homework is to implement a worker pool.

You should download the src archive and compile the simple PING-PONG client and server:

  javac ajeffrey/teaching/pingpong/server/
  javac ajeffrey/teaching/pingpong/client/

This is a simple client-server pair which send PING and PONG messages to each other. You can test the client/server pair by running a server in one window:

  java ajeffrey.teaching.pingpong.server.Main

and a client in another:

  java ajeffrey.teaching.pingpong.client.Main

You should see messages like these at the server:

Thread 1: Starting server
Thread 1: ServerImpl: built
Thread 1: ServerImpl.start: Starting
Thread 1: ServerImpl.start: Opening server socket
Thread 1: ServerImpl.start: Waiting for connection
Thread 1: ServerImpl.start: Got connection
Thread 1: ServerImpl.start: Executing task
Thread 1: Executor.execute: Starting
Thread 1: Executor.execute: Returning
Thread 2: Starting
Thread 2: got PING
Thread 2: Printing PONG message

Once you've got the client/server pair working, you can move onto the homework...

You should open the file ajeffrey/teaching/pingpong/server/, which executes tasks provided by the server. Currently it uses a simplistic one-thread-per-task model. You should change this so that:

Your answer should be put into a zip archive file, and submitted using the Course OnLine system.


Lea Chapter 4.