Skip to content

Commit ae2e559

Browse files
committed
further alignment on jmx connection handling (using jxmremote.rmi.port as
config value)
1 parent 34a7d3b commit ae2e559

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

wilma-application/modules/wilma-safeguard/src/main/java/com/epam/wilma/safeguard/configuration/SafeguardConfigurationAccess.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
along with Wilma. If not, see <http://www.gnu.org/licenses/>.
2020
===========================================================================*/
2121

22+
import org.slf4j.Logger;
23+
import org.slf4j.LoggerFactory;
2224
import org.springframework.beans.factory.annotation.Autowired;
2325
import org.springframework.stereotype.Component;
2426

@@ -36,6 +38,8 @@
3638
public class SafeguardConfigurationAccess implements ConfigurationAccessBase {
3739

3840
private static final String DEFAULT_JMX_PORT = "1099";
41+
private final Logger logger = LoggerFactory.getLogger(SafeguardConfigurationAccess.class);
42+
3943
private PropertyDTO propertyDTO;
4044

4145
@Autowired
@@ -47,11 +51,12 @@ public void loadProperties() {
4751
Long fiOnLimit = propertyHolder.getLong("safeguard.responseFIdecoder.ONlimit");
4852
Long mwOffLimit = propertyHolder.getLong("safeguard.responseMessageWriter.OFFlimit");
4953
Long mwOnLimit = propertyHolder.getLong("safeguard.responseMessageWriter.ONlimit");
50-
String jmxPort = propertyHolder.get("com.sun.management.jmxremote.port");
51-
if ((jmxPort == null) || (tryParseInt(jmxPort) == 0)) {
52-
jmxPort = DEFAULT_JMX_PORT;
54+
String rmiPort = System.getProperty("com.sun.management.jmxremote.rmi.port");
55+
if ((rmiPort == null) || (tryParseInt(rmiPort) == 0)) {
56+
rmiPort = DEFAULT_JMX_PORT;
5357
}
54-
SafeguardLimits safeguardLimits = new SafeguardLimits(fiOffLimit, fiOnLimit, mwOffLimit, mwOnLimit, jmxPort);
58+
logger.info("RMI: using port:" + rmiPort);
59+
SafeguardLimits safeguardLimits = new SafeguardLimits(fiOffLimit, fiOnLimit, mwOffLimit, mwOnLimit, rmiPort);
5560
String cronExpression = propertyHolder.get("safeguard.guardperiod");
5661
propertyDTO = new PropertyDTO(safeguardLimits, cronExpression);
5762
}

0 commit comments

Comments
 (0)