public static void main(String[] args) { SynchronizedObject object = new SynchronizedObject(); object.setValue(1); Thread t = new Thread(new ProcessingThread(object)); t.start(); try { Thread.sleep(1000); } catch (InterruptedException ex) { System.err.println("main::Interrupted: " + ex.getMessage()); } log("main::Setting value"); object.setValue(2); log("main::Value set"); }
public void run() { object.process(); }