From 256b048fcee09264bdd6f4e5a285ee7b7801d9e7 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sun, 29 Nov 2015 16:58:14 -0800 Subject: [PATCH] Support app_id-prefixed jvmarg parameters. This makes sense given that we already support app_id-prefixed apparg parameters, and one might want to configure the JVM specially for different apps from the same installation. Note: unlike apparg, app_id-prefixed jvmargs are appended to un-prefixed jvmargs rather than replacing them. I think this makes sense because you probably want to specify standard JVM args and then maybe tweak a thing or two for your other app. This is also backward compatible which is usually a good thing. It does mean that it's harder to "undo" a jvmarg set for your "default" app, in such cases you'd probably have to not have a default app and instead identify all of your apps with app_ids. --- .../com/threerings/getdown/data/Application.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/threerings/getdown/data/Application.java b/src/main/java/com/threerings/getdown/data/Application.java index d53dd2e..f84c68f 100644 --- a/src/main/java/com/threerings/getdown/data/Application.java +++ b/src/main/java/com/threerings/getdown/data/Application.java @@ -528,10 +528,10 @@ public class Application } } - String prefix = StringUtil.isBlank(_appid) ? "" : (_appid + "."); + String appPrefix = StringUtil.isBlank(_appid) ? "" : (_appid + "."); // determine our application class name - _class = (String)cdata.get(prefix + "class"); + _class = (String)cdata.get(appPrefix + "class"); if (_class == null) { throw new IOException("m.missing_class"); } @@ -622,9 +622,13 @@ public class Application _auxgroups.put(auxgroup, new AuxGroup(auxgroup, codes, rsrcs)); } - // transfer our JVM arguments + // transfer our JVM arguments (we include both "global" args and app_id-prefixed args) String[] jvmargs = ConfigUtil.getMultiValue(cdata, "jvmarg"); addAll(jvmargs, _jvmargs); + if (appPrefix.length() > 0) { + jvmargs = ConfigUtil.getMultiValue(cdata, appPrefix + "jvmarg"); + addAll(jvmargs, _jvmargs); + } // Add the launch specific JVM arguments addAll(_extraJvmArgs, _jvmargs); @@ -633,7 +637,7 @@ public class Application _optimumJvmArgs = ConfigUtil.getMultiValue(cdata, "optimum_jvmarg"); // transfer our application arguments - String[] appargs = ConfigUtil.getMultiValue(cdata, prefix + "apparg"); + String[] appargs = ConfigUtil.getMultiValue(cdata, appPrefix + "apparg"); addAll(appargs, _appargs); // add the launch specific application arguments