Commit 5c5d1ce5 authored by Markus Klinik's avatar Markus Klinik
Browse files

project report: some rules for supermarket

parent 4547a04a
......@@ -516,29 +516,10 @@ As the architecture is given, only correctness criteria are of interest.
\item [a15-synchronization-only-in-converyorbelt-register] Only the classes ConveyorBelt and Register should have synchronization code.
\item [a15-sync-conveyor] ConveyorBelt should have one Lock and two Conditions: itemsAvailable and spaceAvailable.
\item [a15-put-waits-for-space] Putting an item should wait for the condition spaceAvailable, and signal itemsAvailable
\item [a15-remove-waits-for-items] Removing an item should wait for itemsAvailable and signal spaceAvailable
\item [a15-waiting-correctly] Waiting for conditions must happen when the lock is locked.
\item [a15-sync-register] The class Register should have a boolean and two functions for synchronization: claim and free.
\item [a15-claim-waits-for-free] claim waits for the boolean to be false, then sets it to true.
\item [a15-free-register] free sets the boolean to false
\item [a15-use-wait-notify] The easiest way to do this is with synchronized methods and wait and notifyAll, but a lock and one condition is also possible.
\item [a15-register-uses-conveyor] The functions putOnBelt, removeFromBelt, putInBin, and removeFromBin should just call the respective functions from their conveyor belts.
\item [a15-customer-correct] The class Customer should implement the call method as specified.
\item It should claim a random register
\item Then put all items on the belt, followed by a null.
\item Then collect all items from the bin, until it sees the null.
\item Then free the register
\item [a15-cashier-infinite-get-put] The class Cashier should implement the call method as specified.
It should be an infinite loop that just takes items from the belt and puts it to the bin, one by one.
\item [a15-main-waits-for-termination] The main function should wait until all customers are done, and then sum the total number items bought using the Futures of the customers.
\item [a15-main-shuts-down-cashiers] Finally, the main function should terminate all cashiers, for example by using ExecutorService.shutdownNow.
\item [a15-no-synchronized] Only Locks may be used for synchronization.
There should be no synchronized blocks or methods.
\item [a15-sync-register] The class Register should a Lock for synchronization.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment