[jetrix-cvs] SF.net SVN: jetrix:[835] jetrix/trunk/src/java/net/jetrix/Server.java
Brought to you by:
smanux
From: <sm...@us...> - 2010-04-11 21:23:00
|
Revision: 835 http://jetrix.svn.sourceforge.net/jetrix/?rev=835&view=rev Author: smanux Date: 2010-04-11 21:22:54 +0000 (Sun, 11 Apr 2010) Log Message: ----------- The shutdown hooks are now registered when the server is initialized Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/Server.java Modified: jetrix/trunk/src/java/net/jetrix/Server.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/Server.java 2010-04-11 20:45:49 UTC (rev 834) +++ jetrix/trunk/src/java/net/jetrix/Server.java 2010-04-11 21:22:54 UTC (rev 835) @@ -1,6 +1,6 @@ /** * Jetrix TetriNET Server - * Copyright (C) 2001-2009 Emmanuel Bourg + * Copyright (C) 2001-2010 Emmanuel Bourg * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -24,8 +24,6 @@ import java.util.concurrent.*; import java.util.logging.*; -import javax.mail.MessagingException; - import net.jetrix.clients.*; import net.jetrix.commands.*; import net.jetrix.config.*; @@ -34,7 +32,6 @@ import net.jetrix.services.VersionService; import net.jetrix.listeners.ShutdownListener; import net.jetrix.mail.MailSessionManager; -import net.jetrix.mail.MailMessage; /** * Main class, starts the server components and handle the server level messages. @@ -54,9 +51,13 @@ private ChannelManager channelManager; private Client console; - private Server() + private Server() { } + + /** + * Register the shutdown hooks to stop the server properly when the JVM is stopped. + */ + private void registerHooks() { - // add the stop hook Thread hook = new Thread("StopHook") { public void run() @@ -99,6 +100,8 @@ */ private void init() { + registerHooks(); + // read the server configuration config = new ServerConfig(); config.load(configFile); @@ -327,7 +330,7 @@ */ public static void main(String[] args) { - System.out.println("Jetrix TetriNET Server " + ServerConfig.VERSION + ", Copyright (C) 2001-2009 Emmanuel Bourg\n"); + System.out.println("Jetrix TetriNET Server " + ServerConfig.VERSION + ", Copyright (C) 2001-2010 Emmanuel Bourg\n"); Server server = Server.getInstance(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |