


Golf Ball Allocation Monitor
At a golf club, players can hire golf balls
for their game from the club and return them to the club after
use. The better players, who tend not to lose any balls, only
hire one or two. The less experienced players hire more balls, so
that they will have spares during the game in case of loss. They
are, however, required to buy replacements for the lost balls so
that they return the same number that they originally hired. The
golf balls are kept by the club groundsman, who turns out to be a
techie. He decides to treat the players as Java threads and to
write a monitor to allocate golfballs to players, if available,
or to delay the players if insufficient are available.
Simple Allocation Strategy
Allocator.java
SimpleAllocator.java
Player.java
PlayerArrival.java
GolfClub.java
SlotCanvas.java