[Jsmooth-cvs] jsmooth/skeletons/winservice/sample/src AlertServer.java, 1.1, 1.2
Status: Beta
Brought to you by:
reyes
From: Rodrigo R. <re...@us...> - 2007-04-09 22:21:59
|
Update of /cvsroot/jsmooth/jsmooth/skeletons/winservice/sample/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2430/sample/src Modified Files: AlertServer.java Log Message: Index: AlertServer.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/skeletons/winservice/sample/src/AlertServer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AlertServer.java 9 Apr 2007 17:15:50 -0000 1.1 --- AlertServer.java 9 Apr 2007 22:21:23 -0000 1.2 *************** *** 32,35 **** --- 32,37 ---- System.out.println("Received: " + line); fw.write(line + "\n"); + if (line.startsWith("EXIT")) + System.exit(0); fw.close(); JOptionPane.showMessageDialog(null, line, "alert", JOptionPane.ERROR_MESSAGE); *************** *** 75,81 **** } static public void main(String[] args) { ! AlertServer a = new AlertServer(); a.setup(); a.listen(); --- 77,103 ---- } + public void shutdown() + { + try { + FileWriter fw = new FileWriter("c:/shutdown.log", true); + fw.write("END NOW " + System.currentTimeMillis() + "\n"); + fw.close(); + } catch (IOException iox) + { + iox.printStackTrace(); + } + } + static public void main(String[] args) { ! final AlertServer a = new AlertServer(); ! Runtime.getRuntime().addShutdownHook(new Thread() { ! public void run() ! { ! System.out.println("SHUTDOWN..."); ! a.shutdown(); ! } ! }); ! a.setup(); a.listen(); |