Added possibility to set some more JBoss Remoting parameters with config.xml on server start.

This commit is contained in:
LevelX2 2014-10-01 16:04:26 +02:00
parent f62b7ee1d9
commit e0ffef40cc
10 changed files with 127 additions and 24 deletions

View file

@ -48,6 +48,12 @@ public class Config {
logger.fatal("Config error", ex);
}
port = Integer.parseInt(p.getProperty("port"));
secondaryBindPort = Integer.parseInt(p.getProperty("secondaryBindPort"));
backlogSize = Integer.parseInt(p.getProperty("backlogSize"));
numAcceptThreads = Integer.parseInt(p.getProperty("numAcceptThreads"));
maxPoolSize = Integer.parseInt(p.getProperty("numPoolSize"));
leasePeriod = Integer.parseInt(p.getProperty("leasePeriod"));
remoteServer = p.getProperty("remote-server");
maxGameThreads = Integer.parseInt(p.getProperty("max-game-threads"));
maxSecondsIdle = Integer.parseInt(p.getProperty("max-seconds-idle"));
@ -59,6 +65,11 @@ public class Config {
public static final String remoteServer;
public static final int port;
public static final int secondaryBindPort;
public static final int backlogSize;
public static final int numAcceptThreads;
public static final int maxPoolSize;
public static final int leasePeriod;
public static final int maxGameThreads;
public static final int maxSecondsIdle;
public static final int minUserNameLength;

View file

@ -19,13 +19,18 @@
<xs:attribute name="serverAddress" type="xs:string" use="required"/>
<xs:attribute name="serverName" type="xs:string" use="required"/>
<xs:attribute name="port" type="xs:positiveInteger" use="required"/>
<xs:attribute name="secondaryBindPort" type="xs:integer" use="required"/>
<xs:attribute name="backlogSize" type="xs:positiveInteger" use="required"/>
<xs:attribute name="numAcceptThreads" type="xs:positiveInteger" use="required"/>
<xs:attribute name="maxPoolSize" type="xs:positiveInteger" use="required"/>
<xs:attribute name="leasePeriod" type="xs:positiveInteger" use="required"/>
<xs:attribute name="maxGameThreads" type="xs:positiveInteger" use="required"/>
<xs:attribute name="maxSecondsIdle" type="xs:positiveInteger" use="required"/>
<xs:attribute name="minUserNameLength" type="xs:positiveInteger" use="required"/>
<xs:attribute name="maxUserNameLength" type="xs:positiveInteger" use="required"/>
<xs:attribute name="userNamePattern" type="xs:string" use="required"/>
<xs:attribute name="maxAiOpponents" type="xs:string" use="optional"/>
<xs:attribute name="saveGameActivated" type="xs:boolean" use="optional"/>
<xs:attribute name="minUserNameLength" type="xs:positiveInteger" use="required"/>
<xs:attribute name="maxUserNameLength" type="xs:positiveInteger" use="required"/>
<xs:attribute name="userNamePattern" type="xs:string" use="required"/>
<xs:attribute name="maxAiOpponents" type="xs:string" use="optional"/>
<xs:attribute name="saveGameActivated" type="xs:boolean" use="optional"/>
</xs:complexType>
</xs:element>

View file

@ -75,6 +75,26 @@ public class ConfigSettings {
return config.getServer().getPort().intValue();
}
public int getSecondaryBindPort() {
return config.getServer().getSecondaryBindPort().intValue();
}
public int getLeasePeriod() {
return config.getServer().getLeasePeriod().intValue();
}
public int getMaxPoolSize() {
return config.getServer().getMaxPoolSize().intValue();
}
public int getNumAcceptThreads() {
return config.getServer().getNumAcceptThreads().intValue();
}
public int getBacklogSize() {
return config.getServer().getBacklogSize().intValue();
}
public int getMaxGameThreads() {
return config.getServer().getMaxGameThreads().intValue();
}

View file

@ -1,12 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Config.xsd">
<server serverAddress="0.0.0.0" serverName="mage-server" port="17171" maxGameThreads="10"
<server serverAddress="0.0.0.0"
serverName="mage-server"
port="17171"
secondaryBindPort="-1"
backlogSize="200"
numAcceptThreads="2"
maxPoolSize="300"
leasePeriod="5000"
maxGameThreads="10"
maxSecondsIdle="600"
minUserNameLength="3"
maxUserNameLength="14"
userNamePattern="[^a-z0-9_]"
saveGameActivated="true"
maxAiOpponents="15"
saveGameActivated="false"
/>