Browse Source

CB: cleanup

JIV 15 years ago
parent
commit
f6c7891213

+ 0 - 1
L2_CommunityServer/.classpath

@@ -3,7 +3,6 @@
 	<classpathentry kind="src" path="java"/>
 	<classpathentry kind="lib" path="lib/c3p0-0.9.1.2.jar"/>
 	<classpathentry kind="lib" path="lib/javolution-5.3.1.jar"/>
-	<classpathentry kind="lib" path="lib/netcon.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

+ 76 - 76
L2_CommunityServer/java/com/l2jserver/communityserver/Config.java

@@ -27,94 +27,94 @@ import java.util.logging.Logger;
 public final class Config
 {
 	protected static final Logger _log = Logger.getLogger(Config.class.getName());
-	
-    /** Properties file for community server configurations */
-    public static final String  CONFIGURATION_FILE								= "./config/communityserver.properties";
-    /** Properties file for server function configurations */
-    public static final String  GENERAL_FILE									= "./config/General.properties";
 
-    /** ************************************************** **/
+	/** Properties file for community server configurations */
+	public static final String  CONFIGURATION_FILE								= "./config/communityserver.properties";
+	/** Properties file for server function configurations */
+	public static final String  GENERAL_FILE									= "./config/General.properties";
+
+	/** ************************************************** **/
 	/** Server Settings -Begin                             **/
 	/** ************************************************** **/
-    /** Driver to access to database */
-    public static String	DATABASE_DRIVER;
-    /** Path to access to database */
-    public static String	DATABASE_URL;
-    /** Database login */
-    public static String	DATABASE_LOGIN;
-    /** Database password */
-    public static String	DATABASE_PASSWORD;
-    /** Maximum number of connections to the database */
-    public static int		DATABASE_MAX_CONNECTIONS;
-    /** Datapack root directory */
-    public static File		DATAPACK_ROOT;
-    /** Accept alternate ID for server ? */
-    public static boolean	ACCEPT_ALTERNATE_ID;
-    /** ID for request to the server */
-    public static int		REQUEST_ID;
-	
-    /** ************************************************** **/
+	/** Driver to access to database */
+	public static String	DATABASE_DRIVER;
+	/** Path to access to database */
+	public static String	DATABASE_URL;
+	/** Database login */
+	public static String	DATABASE_LOGIN;
+	/** Database password */
+	public static String	DATABASE_PASSWORD;
+	/** Maximum number of connections to the database */
+	public static int		DATABASE_MAX_CONNECTIONS;
+	/** Datapack root directory */
+	public static File		DATAPACK_ROOT;
+	/** Accept alternate ID for server ? */
+	public static boolean	ACCEPT_ALTERNATE_ID;
+	/** ID for request to the server */
+	public static int		REQUEST_ID;
+
+	/** ************************************************** **/
 	/** Server Settings -End                           **/
 	/** ************************************************** **/
 
-    /** Game Server login port */
-    public static int        GAME_SERVER_LOGIN_PORT;
-    /** Game Server login Host */
-    public static String     GAME_SERVER_LOGIN_HOST;
-
-    /** Accept new game server ? */
-    public static boolean ACCEPT_NEW_GAMESERVER;
-
-    public static boolean FLOOD_PROTECTION;
-    public static int     FAST_CONNECTION_LIMIT;
-    public static int     NORMAL_CONNECTION_TIME;
-    public static int     FAST_CONNECTION_TIME;
-    public static int     MAX_CONNECTION_PER_IP;
-    
-    /** General settings */
-    public static int     MIN_PLAYER_LVL_FOR_FORUM;
-    public static int     MIN_CLAN_LVL_FOR_FORUM;
-    public static long    MAIL_AUTO_DELETION_TIME;
-    
-    public static int	  GENERAL_THREAD_CORE_SIZE;
-    
-    public static final void load()
-    {
-    	try
+	/** Game Server login port */
+	public static int        GAME_SERVER_LOGIN_PORT;
+	/** Game Server login Host */
+	public static String     GAME_SERVER_LOGIN_HOST;
+
+	/** Accept new game server ? */
+	public static boolean ACCEPT_NEW_GAMESERVER;
+
+	public static boolean FLOOD_PROTECTION;
+	public static int     FAST_CONNECTION_LIMIT;
+	public static int     NORMAL_CONNECTION_TIME;
+	public static int     FAST_CONNECTION_TIME;
+	public static int     MAX_CONNECTION_PER_IP;
+
+	/** General settings */
+	public static int     MIN_PLAYER_LVL_FOR_FORUM;
+	public static int     MIN_CLAN_LVL_FOR_FORUM;
+	public static long    MAIL_AUTO_DELETION_TIME;
+
+	public static int	  GENERAL_THREAD_CORE_SIZE;
+
+	public static final void load()
+	{
+		try
 		{
 			Properties serverSettings			= new Properties();
 			InputStream is						= new FileInputStream(new File(CONFIGURATION_FILE));
-            serverSettings.load(is);
-            is.close();
-            
-            GAME_SERVER_LOGIN_HOST				= serverSettings.getProperty("CSHostname","*");
-            GAME_SERVER_LOGIN_PORT				= Integer.parseInt(serverSettings.getProperty("CSPort","9013"));
-            
-            ACCEPT_NEW_GAMESERVER				= Boolean.parseBoolean(serverSettings.getProperty("AcceptNewGameServer", "True"));
-            REQUEST_ID							= Integer.parseInt(serverSettings.getProperty("RequestServerID", "0"));
-            ACCEPT_ALTERNATE_ID					= Boolean.parseBoolean(serverSettings.getProperty("AcceptAlternateID", "True"));
-            DATAPACK_ROOT						= new File(serverSettings.getProperty("DatapackRoot", ".")).getCanonicalFile();
-
-            DATABASE_DRIVER						= serverSettings.getProperty("Driver", "com.mysql.jdbc.Driver");
-            DATABASE_URL						= serverSettings.getProperty("URL", "jdbc:mysql://localhost/l2jcb");
-            DATABASE_LOGIN						= serverSettings.getProperty("Login", "root");
-            DATABASE_PASSWORD					= serverSettings.getProperty("Password", "");
-            DATABASE_MAX_CONNECTIONS			= Integer.parseInt(serverSettings.getProperty("MaximumDbConnections", "10"));
-            
-            Properties generalSettings			= new Properties();
+			serverSettings.load(is);
+			is.close();
+
+			GAME_SERVER_LOGIN_HOST				= serverSettings.getProperty("CSHostname","*");
+			GAME_SERVER_LOGIN_PORT				= Integer.parseInt(serverSettings.getProperty("CSPort","9013"));
+
+			ACCEPT_NEW_GAMESERVER				= Boolean.parseBoolean(serverSettings.getProperty("AcceptNewGameServer", "True"));
+			REQUEST_ID							= Integer.parseInt(serverSettings.getProperty("RequestServerID", "0"));
+			ACCEPT_ALTERNATE_ID					= Boolean.parseBoolean(serverSettings.getProperty("AcceptAlternateID", "True"));
+			DATAPACK_ROOT						= new File(serverSettings.getProperty("DatapackRoot", ".")).getCanonicalFile();
+
+			DATABASE_DRIVER						= serverSettings.getProperty("Driver", "com.mysql.jdbc.Driver");
+			DATABASE_URL						= serverSettings.getProperty("URL", "jdbc:mysql://localhost/l2jcb");
+			DATABASE_LOGIN						= serverSettings.getProperty("Login", "root");
+			DATABASE_PASSWORD					= serverSettings.getProperty("Password", "");
+			DATABASE_MAX_CONNECTIONS			= Integer.parseInt(serverSettings.getProperty("MaximumDbConnections", "10"));
+			GENERAL_THREAD_CORE_SIZE			= Integer.parseInt(serverSettings.getProperty("ThreadPoolSize", "1"));
+
+			Properties generalSettings			= new Properties();
 			is									= new FileInputStream(new File(GENERAL_FILE));
-            generalSettings.load(is);
-            is.close();
-            
-            MIN_PLAYER_LVL_FOR_FORUM			= Integer.parseInt(generalSettings.getProperty("MinPlayerLvLForForum", "1"));
-            MIN_CLAN_LVL_FOR_FORUM				= Integer.parseInt(generalSettings.getProperty("MinClanLvLForForum", "2"));
-            MAIL_AUTO_DELETION_TIME				= Long.parseLong(generalSettings.getProperty("MailAutoDeletionTime", "90")) * 86400000;
-            
-            GENERAL_THREAD_CORE_SIZE			= Integer.parseInt(generalSettings.getProperty("ThreadPoolSize", "1"));
+			generalSettings.load(is);
+			is.close();
+
+			MIN_PLAYER_LVL_FOR_FORUM			= Integer.parseInt(generalSettings.getProperty("MinPlayerLvLForForum", "1"));
+			MIN_CLAN_LVL_FOR_FORUM				= Integer.parseInt(generalSettings.getProperty("MinClanLvLForForum", "2"));
+			MAIL_AUTO_DELETION_TIME				= Long.parseLong(generalSettings.getProperty("MailAutoDeletionTime", "90")) * 86400000;
+
 		}
 		catch (Exception e)
 		{
-			
+
 		}
-    }
+	}
 }

+ 1 - 0
L2_CommunityServer/java/com/l2jserver/communityserver/network/GameServerListener.java

@@ -29,6 +29,7 @@ public final class GameServerListener extends NetConnectionListener
 	public GameServerListener(final NetConnectionConfig config) throws IOException
 	{
 		super(config);
+		setName(getClass().getSimpleName());
 	}
 	
 	@Override

+ 1 - 1
L2_CommunityServer/java/com/l2jserver/communityserver/network/GameServerThread.java

@@ -57,6 +57,7 @@ public class GameServerThread extends NetConnection
 	public GameServerThread(final NetConnectionConfig config) throws IOException
 	{
 		super(config);
+		setName(getClass().getSimpleName()+"-"+getId());
 		final KeyPair pair = GameServerRegistrationTable.getInstance().getRandomKeyPair();
 		_privateKey = (RSAPrivateKey)pair.getPrivate();
 		_publicKey = (RSAPublicKey)pair.getPublic();
@@ -168,7 +169,6 @@ public class GameServerThread extends NetConnection
 				}
 				
 				if (packet != null)
-					//new Thread(packet).start();
 					ThreadPoolManager.execute(packet);
 				else
 					throw new IOException("Invalid packet!");

+ 1 - 0
L2_CommunityServer/java/com/l2jserver/communityserver/threading/ThreadPoolManager.java

@@ -40,6 +40,7 @@ public class ThreadPoolManager
 			return false;
 		
 		_mainPool = new ThreadPoolExecutor(Config.GENERAL_THREAD_CORE_SIZE, Config.GENERAL_THREAD_CORE_SIZE + 2, 5L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new PriorityThreadFactory("CommunityServer Executor pool", Thread.NORM_PRIORITY));
+		_mainPool.prestartAllCoreThreads();
 		return true;
 	}
 	

+ 37 - 0
L2_CommunityServer/launcher/Community.launch

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/CommunityServer/java/com/l2jserver/communityserver/L2CommunityServer.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
+<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;sourceLookupDirector&gt;&#13;&#10;&lt;sourceContainers duplicates=&quot;false&quot;&gt;&#13;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#13;&amp;#10;&amp;lt;folder nest=&amp;quot;false&amp;quot; path=&amp;quot;/CommunityServer/java&amp;quot;/&amp;gt;&amp;#13;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.folder&quot;/&gt;&#13;&#10;&lt;/sourceContainers&gt;&#13;&#10;&lt;/sourceLookupDirector&gt;&#13;&#10;"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.debug.ui.target_debug_perspective" value="perspective_default"/>
+<stringAttribute key="org.eclipse.debug.ui.target_run_perspective" value="perspective_default"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;CommunityServer&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;CommunityServer&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/CommunityServer/lib/c3p0-0.9.1.2.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/CommunityServer/lib/javolution-5.3.1.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/CommunityServer/lib/mysql-connector-java-5.1.11-bin.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jserver.communityserver.L2CommunityServer"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="CommunityServer"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx128m"/>
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="D:/_l2j/community/"/>
+<booleanAttribute key="yk-capture-cpu-on-exit" value="false"/>
+<booleanAttribute key="yk-capture-memory-on-exit" value="false"/>
+<booleanAttribute key="yk-disable-alloc" value="false"/>
+<booleanAttribute key="yk-disable-counts" value="false"/>
+<booleanAttribute key="yk-launch-ui" value="true"/>
+<intAttribute key="yk-mem-threshold" value="0"/>
+<booleanAttribute key="yk-startup-with-object-allocations" value="false"/>
+</launchConfiguration>

BIN
L2_CommunityServer/lib/netcon.jar