4.7. Exercises

Exercise 4.1 Our round-robin code only works for a fixed number of participants. How would you make it dynamic, such that participants can be added? Added and deleted?
Exercise 4.2 Rewrite the deli queue example such that multiple workers behind the counter can service the queue of customers. Just as at a typical deli counter, a worker looks at the service number on the display board, takes a request from the customer with the matching ticket number, and services the request. Multiple customers can be serviced at once. Where should the service number now be incremented? Make sure the customer receives an acknowledgment when the request has been completed.

Get JavaSpaces™ Principles, Patterns, and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.