package class4_2_Singleton_eventlogger; public class EventLoggerDemoApp { /** * A dirt-simple application that creates some windows that log * messages to a file using EventLogWriter objects * that all try to write to the same file. * @param args - not used */ public static void main(String[] args) { System.out.println("creating windows"); new UIWindow("Window 1"); new UIWindow("Window 2" ); new UIWindow("Window 3"); new UIWindow("Window 4" ); for(int i=0; i<100; i++ ) { System.out.println("logging msg from main"); // Note: calls getInstance on the main thread EventLogWriter.getInstance().logEvent("msg logged from main"); try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block continue; // keep executing the for-loop } } } } /* for(int i=0; i<100; i++ ) { System.out.println("logging msg from main"); elw.logEvent("msg logged from main"); try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block continue; // keep executing the for-loop } } */