Class Chef
java.lang.Object
lock.allornothing.kitchen.exercise.Chef
- Author:
- __STUDENT_NAME__, Miles Cushing (mcushing@wustl.edu), Dennis Cosgrove
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
attemptToPrepare
(Recipe recipe) Attempts to prepare a specified recipe.
-
Constructor Details
-
Chef
public Chef()
-
-
Method Details
-
attemptToPrepare
Attempts to prepare a specified recipe. This method must be made thread-safe by utilizing the ReentrantLocks that are associated with the appliances in the recipe. Since it is unknown how many locks there will be, you should use theAllOrNothingLockUtils.runWithAllLocksOrDontRunAtAll(List, Runnable)
method defined earlier in the exercise. Finally, use the Recipe's prepare() method to actually prepare the recipe.- Parameters:
recipe
- , the Recipe that contains a list of appliances needed to make cook the item- Returns:
- whether or not the recipe could be prepared at this time.
-