import java.util.concurrent.CountDownLatch; class VarmTortillaTraad implements Runnable{ private final CountDownLatch latch; VarmTortillaTraad(CountDownLatch latch){ this.latch = latch; } @Override public void run(){ try { latch.await(); System.out.println("Varmer opp tortilla"); Thread.sleep((int)(Math.random() * 3000)); System.out.println("Tortilla varmet opp"); } catch (InterruptedException e){ System.out.println("Tortilla-oppvarming ble avbrutt"); System.exit(1); } } }