1 6 7 package com.quikj.server.web; 8 9 import com.quikj.server.framework.*; 10 11 15 public class ShutdownThread extends Thread 16 { 17 private static boolean shutdownHappened = false; 18 private boolean callExit = false; 19 20 21 public ShutdownThread(boolean call_exit) 22 { 23 super(); 24 callExit = call_exit; 25 } 26 27 public ShutdownThread() 28 { 29 this(false); 30 } 31 32 public void run() 33 { 34 if (shutdownHappened == true) return; 35 shutdownHappened = true; 36 37 AceLogger.Instance().log(AceLogger.INFORMATIONAL, AceLogger.SYSTEM_LOG, 38 "HTTPApplicationServer.ShutdownThread() -- Shutting down HTTP Application Server"); 39 40 try 41 { 42 int[] app_list = PluginAppList.Instance().listApplications(); 44 45 for (int i = 0; i < app_list.length; i++) 46 { 47 PluginAppList.Instance().delete(app_list[i]); 48 } 49 50 if (HTTPApplicationServer.getInstance() != null) 51 { 52 HTTPApplicationServer.getInstance().dispose(); 53 } 54 55 } 56 catch (Exception ex) 57 { 58 ; } 60 catch (Error ex) 61 { 62 ; } 64 65 try 66 { 67 sleep(20000); 68 } 69 catch (InterruptedException ex) 70 { 71 ; 72 } 73 74 if (callExit == true) 75 { 76 System.exit(0); 77 } 78 } 79 80 public static void main (String [] args) 81 { 82 ShutdownThread shut = new ShutdownThread(); 83 shut.start(); 84 } 85 } 86 | Popular Tags |