@Override
	/**
	 * (non-Javadoc)
	 * @see java.lang.Runnable#run()
	 */
	public void run() {
		Thread.currentThread().setName(_chefName);
		while ((!this._managmentSentDeathSignal) || (!this._incomingOrders.isEmpty()) || (!this._futuresOfOrder.isEmpty())) {
			try {
				this._orderFinishedSignal.acquire();
			} catch (InterruptedException e1) {
				e1.printStackTrace();
			}
			if (!this._incomingOrders.isEmpty()) {
				Order orderToCook= null;
				try {
					orderToCook= this._incomingOrders.take();
				} catch (InterruptedException e1) {
					e1.printStackTrace();
				}
				CookWholeOrder newWholeOrder= new CookWholeOrder(orderToCook, this._warehouse, this, this._orderFinishedSignal);
				StringBuilder output= new StringBuilder("Chef ");
				output.append(this._chefName).append(" took order ").append(newWholeOrder.getID());
				Chef._LOGGER.info(output.toString());
				Future<Order> currentFuture= this._cookWholeOrderCompletion.submit(newWholeOrder);
				this._futuresOfOrder.add(currentFuture);
			}
			else if (!this._futuresOfOrder.isEmpty()){
				Order orderSentToCooking= null;
				Future<Order> futureOfOrderSentToCooking= null;
				try {
					futureOfOrderSentToCooking = this._cookWholeOrderCompletion.take(); //waits until has order done
					orderSentToCooking= futureOfOrderSentToCooking.get();
				} catch (Exception e) {
					e.printStackTrace();
				}
				this._futuresOfOrder.remove(futureOfOrderSentToCooking);
				double orderDifficulty = orderSentToCooking.getDifficultyRating();
				this._management.sendOrderToDeliveryPersons(orderSentToCooking);
				this._currentPressure= this._currentPressure - orderDifficulty;
			}		
		}
		this._cookWholeOrderExecutor.shutdown();
		this._signalOnDeath.countDown();
	}