Skip to content

Commit

Permalink
GEODE-746: When starting a locator using --bind-address, gfsh prints …
Browse files Browse the repository at this point in the history
…incorrect connect message

* This closes apache#208
  • Loading branch information
Kevin J. Duling authored and jinmeiliao committed Jul 18, 2016
1 parent 582423c commit 3473229
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,18 @@
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.Query;
import javax.management.QueryExp;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException;

import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.shell.core.annotation.CliOption;

import com.gemstone.gemfire.GemFireException;
import com.gemstone.gemfire.SystemFailure;
import com.gemstone.gemfire.cache.server.CacheServer;
Expand Down Expand Up @@ -112,10 +117,6 @@
import com.gemstone.gemfire.management.internal.configuration.messages.SharedConfigurationStatusResponse;
import com.gemstone.gemfire.security.AuthenticationFailedException;

import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
import org.springframework.shell.core.annotation.CliCommand;
import org.springframework.shell.core.annotation.CliOption;

/**
* The LauncherLifecycleCommands class encapsulates all GemFire launcher commands for GemFire tools (like starting
* GemFire Monitor (GFMon) and Visual Statistics Display (VSD)) as well external tools (like jconsole).
Expand Down Expand Up @@ -428,7 +429,14 @@ public void notifyInputLine(String line) {
} else {
infoResultData.addLine(locatorState.toString());

String locatorHostName = StringUtils.defaultIfBlank(locatorLauncher.getHostnameForClients(), getLocalHost());
String locatorHostName;
InetAddress bindAddr = locatorLauncher.getBindAddress();
if (bindAddr != null){
locatorHostName = bindAddr.getCanonicalHostName();
} else {
locatorHostName = StringUtils.defaultIfBlank(locatorLauncher.getHostnameForClients(), getLocalHost());
}

int locatorPort = Integer.parseInt(locatorState.getPort());

// AUTO-CONNECT
Expand Down Expand Up @@ -569,7 +577,7 @@ private boolean doAutoConnect(final String locatorHostname,
getGfsh().setOperationInvoker(new JmxOperationInvoker(memberEndpoint.getHost(), memberEndpoint.getPort(),
null, null, configurationProperties, null));

String shellAndLogMessage = CliStrings.format(CliStrings.CONNECT__MSG__SUCCESS, memberEndpoint.toString(false));
String shellAndLogMessage = CliStrings.format(CliStrings.CONNECT__MSG__SUCCESS, "JMX Manager " + memberEndpoint.toString(false));

infoResultData.addLine("\n");
infoResultData.addLine(shellAndLogMessage);
Expand Down Expand Up @@ -624,6 +632,7 @@ private void doOnConnectionFailure(final String locatorHostName,
final boolean jmxManagerAuthEnabled,
final boolean jmxManagerSslEnabled,
final InfoResultData infoResultData) {

infoResultData.addLine("\n");
infoResultData.addLine(CliStrings.format(CliStrings.START_LOCATOR__USE__0__TO__CONNECT,
new CommandStringBuilder(CliStrings.CONNECT).addOption(CliStrings.CONNECT__LOCATOR,
Expand Down

0 comments on commit 3473229

Please sign in to comment.