OOP-Projects-Java

Log | Files | Refs | README

commit 72aa23ad66d8b080035f1814c57e83b6c13c3797
parent 4f710025600aa6129ef90b0521fb947b20d4cb24
Author: William Lindholm <a22willi@student.his.se>
Date:   Wed, 29 Mar 2023 12:57:28 +0200

Added comments

Diffstat:
MOOP2023_a22willi_a21liltr_assignment3/src/breakRoom/Main.java | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/OOP2023_a22willi_a21liltr_assignment3/src/breakRoom/Main.java b/OOP2023_a22willi_a21liltr_assignment3/src/breakRoom/Main.java @@ -5,7 +5,10 @@ import java.util.Scanner; public class Main extends Thread { - + /** + * Used to start the coffee simulation + * @throws InterruptedException + */ private void startCoffeSimulation() throws InterruptedException { CoffeeQueue queue = new CoffeeQueue(); CoffeeMaker coffeeMachine = new CoffeeMaker(queue); @@ -14,6 +17,7 @@ public class Main extends Thread { System.out.println("======Started Simulation====="); + //start all workers for (int i = 0; i < numberOfWorkers; i++) { workers.add(new Worker(("worker" + i), queue)); workers.get(i).start(); @@ -22,6 +26,7 @@ public class Main extends Thread { // wait for 20 seconds Thread.sleep(20000); + //Stop all workers for (int i = 0; i < numberOfWorkers; i++) { workers.get(i).cancel(); }