/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package frozenapp; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author martin */ public class App { private static final Object LOCK = new Object(); private static Double result; public static void main(String[] args) { result = Double.NaN; //new java.util.Random().nextDouble(); Thread computation = new Thread(new Compute()); computation.start(); // BREAKPOINT 1 synchronized (LOCK) { try { LOCK.wait(); } catch (InterruptedException ex) { Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); } } System.exit((result == 1.0) ? 0 : 1); // BREAKPOINT 2 } private static class Compute implements Runnable { public void run() { try { Thread.sleep(1000); } catch (InterruptedException ex) { Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); } result = 1.0; synchronized (LOCK) { LOCK.notify(); } } } }