Ability to specify VM arguments for the web frontend.
1.1 --- a/remoting/server/hudson/src/main/java/org/netbeans/modules/jackpot30/hudson/IndexingBuilder.java Wed Oct 24 16:42:09 2012 +0200
1.2 +++ b/remoting/server/hudson/src/main/java/org/netbeans/modules/jackpot30/hudson/IndexingBuilder.java Wed Oct 24 18:55:51 2012 +0200
1.3 @@ -259,9 +259,11 @@
1.4 public static final class DescriptorImpl extends Descriptor<Builder> {
1.5
1.6 private File cacheDir;
1.7 + private String webVMOptions;
1.8
1.9 public DescriptorImpl() {
1.10 cacheDir = new File(Hudson.getInstance().getRootDir(), "index").getAbsoluteFile();
1.11 + webVMOptions = "";
1.12 load();
1.13 }
1.14
1.15 @@ -269,6 +271,10 @@
1.16 return cacheDir;
1.17 }
1.18
1.19 + public String getWebVMOptions() {
1.20 + return webVMOptions;
1.21 + }
1.22 +
1.23 @Override
1.24 public Builder newInstance(StaplerRequest req, JSONObject formData) throws FormException {
1.25 return new IndexingBuilder(req, formData);
1.26 @@ -278,9 +284,22 @@
1.27 public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
1.28 cacheDir = new File(json.getString("cacheDir"));
1.29
1.30 + String newWebVMOptions = json.getString("webVMOptions");
1.31 +
1.32 + if (newWebVMOptions == null) newWebVMOptions = "";
1.33 +
1.34 + boolean restartWebFrontEnd = !webVMOptions.equals(newWebVMOptions);
1.35 +
1.36 + webVMOptions = newWebVMOptions;
1.37 +
1.38 save();
1.39
1.40 - return super.configure(req, json);
1.41 + boolean result = super.configure(req, json);
1.42 +
1.43 + if (restartWebFrontEnd)
1.44 + WebFrontEnd.restart();
1.45 +
1.46 + return result;
1.47 }
1.48
1.49 @Override
2.1 --- a/remoting/server/hudson/src/main/java/org/netbeans/modules/jackpot30/hudson/WebFrontEnd.java Wed Oct 24 16:42:09 2012 +0200
2.2 +++ b/remoting/server/hudson/src/main/java/org/netbeans/modules/jackpot30/hudson/WebFrontEnd.java Wed Oct 24 18:55:51 2012 +0200
2.3 @@ -63,6 +63,7 @@
2.4 import java.util.Collections;
2.5 import java.util.logging.Level;
2.6 import java.util.logging.Logger;
2.7 +import org.netbeans.modules.jackpot30.hudson.IndexingBuilder.DescriptorImpl;
2.8
2.9 /**
2.10 *
2.11 @@ -114,6 +115,11 @@
2.12 }
2.13 }
2.14
2.15 + public static void restart() {
2.16 + stop();
2.17 + ensureStarted();
2.18 + }
2.19 +
2.20 @Extension
2.21 public static final class RestartIndexingFrontend extends CLICommand {
2.22
2.23 @@ -222,6 +228,7 @@
2.24 args.add(cacheDir);
2.25
2.26 doStart(launcher.launch().cmds(args)
2.27 + .envs(Collections.singletonMap("JACKPOT_WEB_OPTS", ((DescriptorImpl) DescriptorImpl.find(DescriptorImpl.class.getName())).getWebVMOptions()))
2.28 .stdout(listener),
2.29 requestId);
2.30 } catch (IOException ex) {
3.1 --- a/remoting/server/hudson/src/main/resources/org/netbeans/modules/jackpot30/hudson/IndexingBuilder/global.jelly Wed Oct 24 16:42:09 2012 +0200
3.2 +++ b/remoting/server/hudson/src/main/resources/org/netbeans/modules/jackpot30/hudson/IndexingBuilder/global.jelly Wed Oct 24 18:55:51 2012 +0200
3.3 @@ -4,6 +4,11 @@
3.4 <f:entry title="Cache directory:" field="cacheDir">
3.5 <f:textbox />
3.6 </f:entry>
3.7 + <f:advanced>
3.8 + <f:entry title="Web frontend VM Options" field="webVMOptions">
3.9 + <f:textbox />
3.10 + </f:entry>
3.11 + </f:advanced>
3.12 </f:section>
3.13
3.14 </j:jelly>