java.lang.Object
lock.allornothing.kitchen.exercise.Chef

public class Chef extends Object
Author:
__STUDENT_NAME__, Miles Cushing (mcushing@wustl.edu), Dennis Cosgrove
  • Constructor Details

    • Chef

      public Chef()
  • Method Details

    • attemptToPrepare

      public boolean attemptToPrepare(Recipe recipe)
      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 the AllOrNothingLockUtils.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.