1 package ch.hslu.exercises.sw06.ex1; 2 3 import org.slf4j.Logger; 4 import org.slf4j.LoggerFactory; 5 6 public final class MyTask implements Runnable { 7 private static final Logger LOG = LoggerFactory.getLogger(MyTask.class); 8 private final Object lock; 9 10 public MyTask(final Object lock) { 11 this.lock = lock; 12 } 13 14 @Override 15 public void run() { 16 synchronized (lock) { 17 LOG.info("warten..."); 18 try { 19 lock.wait(); 20 } catch (InterruptedException ex) { 21 return; 22 } 23 } 24 LOG.info("...aufgewacht"); 25 } 26 }