+
+ private class ShutdownHandler extends Thread {
+ public void run() {
+ sdhook = null;
+ DirServer.this.stop();
+ try {
+ main.join();
+ } catch(InterruptedException e) {}
+ }
+ }
+
+ protected void shutdown() {
+ try {
+ if(sdhook != null)
+ Runtime.getRuntime().removeShutdownHook(sdhook);
+ } catch(Exception e) {}
+ synchronized(contexts) {
+ for(Iterator<Map.Entry<File, DSContext>> i = contexts.entrySet().iterator(); i.hasNext();) {
+ Map.Entry<File, DSContext> e = i.next();
+ DSContext ctx = e.getValue();
+ i.remove();
+ ctx.tg.shutdown();
+ }
+ }
+ super.shutdown();
+ try {
+ ManagementFactory.getPlatformMBeanServer().unregisterMBean(dolda.jsvc.scgi.jmx.Server.name);
+ } catch(InstanceNotFoundException e) {
+ } catch(MBeanRegistrationException e) {
+ }
+ }