Do some real cleanup work at shutdown. Apps are now stopped and Loggers
are flushed and closed. Still to do: Close server ports.
This commit is contained in:
parent
fd74552857
commit
b90ef71017
1 changed files with 12 additions and 2 deletions
|
@ -1,6 +1,9 @@
|
||||||
// HelmaShutdownHook.java
|
// HelmaShutdownHook.java
|
||||||
package helma.main;
|
package helma.main;
|
||||||
|
|
||||||
|
import helma.util.Logger;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ShutdownHook that shuts down all running Helma applications on exit.
|
* ShutdownHook that shuts down all running Helma applications on exit.
|
||||||
*/
|
*/
|
||||||
|
@ -13,8 +16,15 @@ public class HelmaShutdownHook extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run () {
|
public void run () {
|
||||||
System.err.print ("Shutting down Helma...");
|
Logger logger = Server.getLogger();
|
||||||
System.err.println ("done");
|
if (logger != null)
|
||||||
|
logger.log ("Shutting down Helma");
|
||||||
|
appmgr.stopAll ();
|
||||||
|
List loggers = Logger.getLoggers();
|
||||||
|
int l = loggers.size();
|
||||||
|
for (int i=0; i<l; i++)
|
||||||
|
((Logger) loggers.get(i)).close();
|
||||||
|
Logger.wakeup();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue