From e0ffef40cc9afcd734c78e7979dbd466b0b484cb Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 1 Oct 2014 16:04:26 +0200 Subject: [PATCH] Added possibility to set some more JBoss Remoting parameters with config.xml on server start. --- .../src/main/java/mage/client/MageFrame.java | 2 +- Mage.Common/src/mage/remote/Connection.java | 18 ++++++++++--- Mage.Server/config/config.xml | 24 +++++++++++++++++ Mage.Server/release/config/config.xml | 9 ++++++- .../src/main/java/mage/server/Main.java | 26 ++++++++++++++----- .../main/java/mage/server/util/Config.java | 11 ++++++++ .../src/main/java/mage/server/util/Config.xsd | 15 +++++++---- .../java/mage/server/util/ConfigSettings.java | 20 ++++++++++++++ .../mage/server/util/resources/config.xml | 11 ++++++-- .../main/xml-resources/jaxb/Config/Config.xsd | 15 +++++++---- 10 files changed, 127 insertions(+), 24 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index 32d87684e7..d2448455b6 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -695,7 +695,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { String server = prefs.get("serverAddress", ""); int port = Integer.parseInt(prefs.get("serverPort", "")); String proxyServer = prefs.get("proxyAddress", ""); - int proxyPort = Integer.parseInt(prefs.get("proxyPort", "")); + int proxyPort = Integer.parseInt(prefs.get("proxyPort", "0")); ProxyType proxyType = ProxyType.valueByText(prefs.get("proxyType", "None")); String proxyUsername = prefs.get("proxyUsername", ""); String proxyPassword = prefs.get("proxyPassword", ""); diff --git a/Mage.Common/src/mage/remote/Connection.java b/Mage.Common/src/mage/remote/Connection.java index 80e547a2e5..1ed71907f0 100644 --- a/Mage.Common/src/mage/remote/Connection.java +++ b/Mage.Common/src/mage/remote/Connection.java @@ -56,9 +56,19 @@ public class Connection { private boolean showAbilityPickerForced; private UserSkipPrioritySteps userSkipPrioritySteps; - private static final String serialization = "?serializationtype=jboss"; + private static final String serialization = "?serializationtype=jboss"; private static final String transport = "bisocket"; + private final String parameter; + + public Connection() { + this(""); + } + + public Connection(String parameter) { + this.parameter = parameter; + } + @Override public int hashCode() { return (transport + host + Integer.toString(port) + proxyType.toString()).hashCode(); @@ -75,7 +85,7 @@ public class Connection { @Override public String toString() { - return host + ":" + Integer.toString(port) + "/" + serialization; + return host + ":" + Integer.toString(port) + "/" + serialization + parameter; } public String getURI() { @@ -83,13 +93,13 @@ public class Connection { try { InetAddress inet = getLocalAddress(); if (inet != null) { - return transport + "://" + inet.getHostAddress() + ":" + port + "/" + serialization; + return transport + "://" + inet.getHostAddress() + ":" + port + "/" + serialization + parameter; } } catch (SocketException ex) { // just use localhost if can't find local ip } } - return transport + "://" + host + ":" + port + "/" + serialization; + return transport + "://" + host + ":" + port + "/" + serialization + parameter; } public ProxyType getProxyType() { diff --git a/Mage.Server/config/config.xml b/Mage.Server/config/config.xml index 76f5435e36..698e6a3081 100644 --- a/Mage.Server/config/config.xml +++ b/Mage.Server/config/config.xml @@ -1,9 +1,33 @@ + - + + + + + - - - - - + + + + + diff --git a/Mage.Server/src/main/java/mage/server/util/ConfigSettings.java b/Mage.Server/src/main/java/mage/server/util/ConfigSettings.java index 3b9ac6bd86..cee5d5bdee 100644 --- a/Mage.Server/src/main/java/mage/server/util/ConfigSettings.java +++ b/Mage.Server/src/main/java/mage/server/util/ConfigSettings.java @@ -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(); } diff --git a/Mage.Server/src/main/java/mage/server/util/resources/config.xml b/Mage.Server/src/main/java/mage/server/util/resources/config.xml index 4070ed9787..56ca070a03 100644 --- a/Mage.Server/src/main/java/mage/server/util/resources/config.xml +++ b/Mage.Server/src/main/java/mage/server/util/resources/config.xml @@ -1,12 +1,19 @@ - diff --git a/Mage.Server/src/main/xml-resources/jaxb/Config/Config.xsd b/Mage.Server/src/main/xml-resources/jaxb/Config/Config.xsd index 106f34a1d3..8e57894338 100644 --- a/Mage.Server/src/main/xml-resources/jaxb/Config/Config.xsd +++ b/Mage.Server/src/main/xml-resources/jaxb/Config/Config.xsd @@ -22,11 +22,16 @@ - - - - - + + + + + + + + + +