Skip to content

Commit

Permalink
0003404: --jmx-disable command line option doesn't disable JMX.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmichalek committed Feb 2, 2018
1 parent 754b995 commit 26c6de4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Expand Up @@ -64,7 +64,7 @@

public abstract class AbstractCommandLauncher {

protected static final Logger log;
private static final Logger log;

public static final String DEFAULT_SERVER_PROPERTIES;

Expand Down
Expand Up @@ -100,6 +100,7 @@ protected void printHelp(CommandLine cmd, Options options) {
super.printHelp(cmd, options);
}

@Override
protected void buildOptions(Options options) {
super.buildOptions(options);
buildCryptoOptions(options);
Expand All @@ -120,6 +121,7 @@ protected void buildOptions(Options options) {
addOption(options, OPTION_WINXP, OPTION_WINXP, false);
}

@Override
protected boolean executeWithOptions(CommandLine line) throws Exception {

String host = null;
Expand Down Expand Up @@ -167,7 +169,9 @@ protected boolean executeWithOptions(CommandLine line) throws Exception {
noDirectBuffer = true;
}

if (!line.hasOption(OPTION_JMX_DISABLE)) {
boolean jmxEnabledFlag = !line.hasOption(OPTION_JMX_DISABLE);

if (jmxEnabledFlag) {
if (line.hasOption(OPTION_JMX_PORT)) {
jmxPort = new Integer(line.getOptionValue(OPTION_JMX_PORT));
} else {
Expand All @@ -190,12 +194,14 @@ protected boolean executeWithOptions(CommandLine line) throws Exception {
this.start();
}

@Override
public void run() {
log.info("Starting workaround thread to prevent system clock acceleration on Windows XP");
while (true) {
try {
Thread.sleep(Integer.MAX_VALUE);
} catch (InterruptedException ex) {
// ignored.
}
}
}
Expand All @@ -214,6 +220,7 @@ public void run() {
webServer.setBasicAuthUsername(httpBasicAuthUser);
webServer.setBasicAuthPassword(httpBasicAuthPassword);

webServer.setJmxEnabled(jmxEnabledFlag);
if (jmxPort > 0) {
webServer.setJmxPort(jmxPort);
}
Expand Down Expand Up @@ -281,6 +288,7 @@ protected void removeOldHeapDumps() {
}

Collections.sort(recentFiles, new Comparator<File>() {
@Override
public int compare(File f1, File f2) {
return f1.lastModified() > f2.lastModified() ? -1 : 1;
}
Expand All @@ -297,6 +305,7 @@ public int compare(File f1, File f2) {
}
}

@SuppressWarnings("unused")
protected String chooseWebDir(CommandLine line, String webDir) {
return webDir;
}
Expand Down

0 comments on commit 26c6de4

Please sign in to comment.