mirror of
https://github.com/corda/corda.git
synced 2024-12-18 12:46:29 +00:00
Merge pull request #7755 from corda/jzadroga/ent-11951/multiple-add-opens
ENT-11951: Add support for multiple add-opens CLI args to CordaCaplet
This commit is contained in:
commit
2d8e68211f
@ -34,6 +34,8 @@ public class CordaCaplet extends Capsule {
|
||||
private Config nodeConfig = null;
|
||||
private String baseDir = null;
|
||||
|
||||
private final List<String> cmdLineAddOpens = new ArrayList<>();
|
||||
|
||||
protected CordaCaplet(Capsule pred) {
|
||||
super(pred);
|
||||
}
|
||||
@ -101,6 +103,7 @@ public class CordaCaplet extends Capsule {
|
||||
protected ProcessBuilder prelaunch(List<String> jvmArgs, List<String> args) {
|
||||
checkJavaVersion();
|
||||
nodeConfig = parseConfigFile(args);
|
||||
cmdLineAddOpens.addAll(jvmArgs.stream().filter(arg -> arg.startsWith("--add-opens")).collect(toList()));
|
||||
return super.prelaunch(jvmArgs, args);
|
||||
}
|
||||
|
||||
@ -119,7 +122,9 @@ public class CordaCaplet extends Capsule {
|
||||
@Override
|
||||
protected int launch(ProcessBuilder pb) throws IOException, InterruptedException {
|
||||
List<String> args = pb.command();
|
||||
args.addAll(1, getNodeJvmArgs());
|
||||
List<String> nodeJvmArgs = getNodeJvmArgs();
|
||||
nodeJvmArgs.addAll(cmdLineAddOpens);
|
||||
args.addAll(1, nodeJvmArgs);
|
||||
pb.command(args);
|
||||
return super.launch(pb);
|
||||
}
|
||||
@ -168,6 +173,7 @@ public class CordaCaplet extends Capsule {
|
||||
boolean defaultOutOfMemoryErrorHandling = true;
|
||||
try {
|
||||
List<String> configJvmArgs = nodeConfig.getStringList("custom.jvmArgs");
|
||||
cmdLineAddOpens.addAll(configJvmArgs.stream().filter(arg -> arg.startsWith("--add-opens")).collect(toList()));
|
||||
jvmArgs.clear();
|
||||
jvmArgs.addAll(configJvmArgs);
|
||||
log(LOG_VERBOSE, "Configured JVM args = " + jvmArgs);
|
||||
|
@ -12,6 +12,7 @@
|
||||
--add-opens=java.base/java.time=ALL-UNNAMED
|
||||
--add-opens=java.base/java.util=ALL-UNNAMED
|
||||
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED
|
||||
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED
|
||||
--add-opens=java.base/java.util.regex=ALL-UNNAMED
|
||||
--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED
|
||||
--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED
|
||||
|
Loading…
Reference in New Issue
Block a user