Skip to content

Commit

Permalink
#785: Add option to control join server thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus committed Nov 28, 2013
1 parent 8c84862 commit a62cebf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
13 changes: 10 additions & 3 deletions hawtio-embedded/src/main/java/io/hawt/embedded/Main.java
Expand Up @@ -30,7 +30,6 @@
*/
public class Main {
private Options options;
private final boolean joinServerThread = true;
private boolean welcome = true;

public Main() {
Expand Down Expand Up @@ -67,9 +66,9 @@ public static void doRun(Main main) {
}

public void run() throws Exception {
run(joinServerThread);

run(options.isJointServerThread());
}

public void run(boolean join) throws Exception {
System.setProperty("org.eclipse.jetty.util.log.class", Slf4jLog.class.getName());
Slf4jLog log = new Slf4jLog("jetty");
Expand Down Expand Up @@ -197,6 +196,14 @@ public void setExtraClassPath(String extraClassPath) {
options.setExtraClassPath(extraClassPath);
}

public boolean isJoinServerThread() {
return options.isJointServerThread();
}

public void setJoinServerThread(boolean joinServerThread) {
options.setJointServerThread(joinServerThread);
}

public boolean isHelp() {
return options.isHelp();
}
Expand Down
15 changes: 15 additions & 0 deletions hawtio-embedded/src/main/java/io/hawt/embedded/Options.java
Expand Up @@ -31,6 +31,7 @@ public class Options {
private Integer port = 8080;
private String extraClassPath;
private boolean help;
private boolean jointServerThread = true;

private abstract class Option {
private String abbreviation;
Expand Down Expand Up @@ -100,6 +101,12 @@ protected void doProcess(String arg, LinkedList<String> remainingArgs) {
}
});

addOption(new ParameterOption("j", "join", "Join server thread") {
protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
jointServerThread = "true".equalsIgnoreCase(parameter);
}
});

addOption(new ParameterOption("w", "war", "War file or directory of the hawtio web application") {
protected void doProcess(String arg, String parameter, LinkedList<String> remainingArgs) {
war = parameter;
Expand Down Expand Up @@ -242,6 +249,14 @@ public void setExtraClassPath(String extraClassPath) {
this.extraClassPath = extraClassPath;
}

public boolean isJointServerThread() {
return jointServerThread;
}

public void setJointServerThread(boolean jointServerThread) {
this.jointServerThread = jointServerThread;
}

public boolean isHelp() {
return help;
}
Expand Down

0 comments on commit a62cebf

Please sign in to comment.