Skip to content

Commit

Permalink
Functions: add -Dio.netty.tryReflectionSetAccessible=true to Java fun…
Browse files Browse the repository at this point in the history
…ctions (apache#12624)
  • Loading branch information
eolivelli authored Nov 9, 2021
1 parent 24b0f4f commit d1010fa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ public static List<String> getCmd(InstanceConfig instanceConfig,
"%s-%s",
instanceConfig.getFunctionDetails().getName(),
shardId));

args.add("-Dio.netty.tryReflectionSetAccessible=true");

if (!isEmpty(instanceConfig.getFunctionDetails().getRuntimeFlags())) {
for (String runtimeFlagArg : splitRuntimeArgs(instanceConfig.getFunctionDetails().getRuntimeFlags())) {
args.add(runtimeFlagArg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,14 @@ private void verifyJavaInstance(InstanceConfig config, String depsDir, boolean s
if (null != depsDir) {
extraDepsEnv = " -Dpulsar.functions.extra.dependencies.dir=" + depsDir;
classpath = classpath + ":" + depsDir + "/*";
totalArgs = 39;
totalArgs = 40;
portArg = 26;
metricsPortArg = 28;
} else {
extraDepsEnv = "";
portArg = 25;
metricsPortArg = 27;
totalArgs = 38;
totalArgs = 39;
}
if (secretsAttached) {
totalArgs += 4;
Expand Down Expand Up @@ -434,7 +434,7 @@ private void verifyJavaInstance(InstanceConfig config, String depsDir, boolean s
+ " -Dlog4j.configurationFile=kubernetes_instance_log4j2.xml "
+ "-Dpulsar.function.log.dir=" + logDirectory + "/" + FunctionCommon.getFullyQualifiedName(config.getFunctionDetails())
+ " -Dpulsar.function.log.file=" + config.getFunctionDetails().getName() + "-$SHARD_ID"
+ " -Xmx" + String.valueOf(RESOURCES.getRam())
+ " -Dio.netty.tryReflectionSetAccessible=true -Xmx" + String.valueOf(RESOURCES.getRam())
+ " org.apache.pulsar.functions.instance.JavaInstanceMain"
+ " --jar " + jarLocation + " --instance_id "
+ "$SHARD_ID" + " --function_id " + config.getFunctionId()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,21 +298,21 @@ private void verifyJavaInstance(InstanceConfig config, Path depsDir, String webS
String extraDepsEnv;
int portArg;
int metricsPortArg;
int totalArgCount = 41;
int totalArgCount = 42;
if (webServiceUrl != null && config.isExposePulsarAdminClientEnabled()) {
totalArgCount += 3;
}
if (null != depsDir) {
assertEquals(args.size(), totalArgCount);
extraDepsEnv = " -Dpulsar.functions.extra.dependencies.dir=" + depsDir.toString();
classpath = classpath + ":" + depsDir + "/*";
portArg = 24;
metricsPortArg = 26;
portArg = 25;
metricsPortArg = 27;
} else {
assertEquals(args.size(), totalArgCount-1);
extraDepsEnv = "";
portArg = 23;
metricsPortArg = 25;
portArg = 24;
metricsPortArg = 26;
}
if (webServiceUrl != null && config.isExposePulsarAdminClientEnabled()) {
portArg += 3;
Expand All @@ -328,6 +328,7 @@ private void verifyJavaInstance(InstanceConfig config, Path depsDir, String webS
+ " -Dlog4j.configurationFile=java_instance_log4j2.xml "
+ "-Dpulsar.function.log.dir=" + logDirectory + "/functions/" + FunctionCommon.getFullyQualifiedName(config.getFunctionDetails())
+ " -Dpulsar.function.log.file=" + config.getFunctionDetails().getName() + "-" + config.getInstanceId()
+ " -Dio.netty.tryReflectionSetAccessible=true"
+ " org.apache.pulsar.functions.instance.JavaInstanceMain"
+ " --jar " + userJarFile + " --instance_id "
+ config.getInstanceId() + " --function_id " + config.getFunctionId()
Expand Down

0 comments on commit d1010fa

Please sign in to comment.