Skip to content

Commit

Permalink
Merge pull request #133 from hamid646/fix-unknown-host
Browse files Browse the repository at this point in the history
Resolve the host only if JMX is enabled
  • Loading branch information
killme2008 authored Sep 28, 2021
2 parents e5340b5 + e52384b commit 64ce827
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ private void initialize() {
if (mbserver != null && connectorServer != null && connectorServer.isActive()) {
return;
}
// 鍒涘缓MBServer
String hostName = null;
try {
InetAddress addr = InetAddress.getLocalHost();

hostName = addr.getHostName();
} catch (IOException e) {
log.error("Get HostName Error", e);
hostName = "localhost";
}
String host = System.getProperty("hostName", hostName);
try {
boolean enableJMX =
Boolean.parseBoolean(System.getProperty(Constants.XMEMCACHED_JMX_ENABLE, "false"));
if (enableJMX) {
// 鍒涘缓MBServer
String hostName = null;
try {
InetAddress addr = InetAddress.getLocalHost();

hostName = addr.getHostName();
} catch (IOException e) {
log.error("Get HostName Error", e);
hostName = "localhost";
}
String host = System.getProperty("hostName", hostName);
mbserver = ManagementFactory.getPlatformMBeanServer();
int port = Integer.parseInt(System.getProperty(Constants.XMEMCACHED_RMI_PORT, "7077"));
String rmiName = System.getProperty(Constants.XMEMCACHED_RMI_NAME, "xmemcachedServer");
Expand Down

0 comments on commit 64ce827

Please sign in to comment.