Hadoop: pass JDK 9+ options to nodes in external processes. This closes
@@ -28,6 +28,7 @@ import java.io.PrintWriter;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.apache.ignite.IgniteSystemProperties;
@@ -37,6 +38,7 @@ import org.apache.ignite.hadoop.fs.IgniteHadoopFileSystemCounterWriter;
import org.apache.ignite.igfs.IgfsInputStream;
import org.apache.ignite.igfs.IgfsPath;
import org.apache.ignite.internal.IgnitionEx;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.processors.hadoop.HadoopCommonUtils;
import org.apache.ignite.internal.processors.hadoop.HadoopJobEx;
import org.apache.ignite.internal.processors.hadoop.jobtracker.HadoopJobTracker;
@@ -45,6 +47,8 @@ import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.testframework.junits.IgniteTestResources;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
/**
@@ -250,12 +254,34 @@ public class HadoopCommandLineTest extends GridCommonAbstractTest {
res.environment().put("HADOOP_HOME", hadoopHome);
res.environment().put("HADOOP_CLASSPATH", ggClsPath);
res.environment().put("HADOOP_CONF_DIR", testWorkDir.getAbsolutePath());
+ res.environment().put("HADOOP_OPTS", filteredJvmArgs());
res.redirectErrorStream(true);
return res;
}
+ /**
+ * Creates list of JVM arguments to be used to start hadoop process.
+ *
+ * @return JVM arguments.
+ */
+ private String filteredJvmArgs() {
+ StringBuilder filteredJvmArgs = new StringBuilder();
+
+ filteredJvmArgs.append("-ea");
+
+ for (String arg : U.jvmArgs()) {
+ if (arg.startsWith("--add-opens") || arg.startsWith("--add-exports") || arg.startsWith("--add-modules") ||
+ arg.startsWith("--patch-module") || arg.startsWith("--add-reads") ||
+ arg.startsWith("-XX:+IgnoreUnrecognizedVMOptions"))
+ filteredJvmArgs.append(' ').append(arg);
+ }
+
+ return filteredJvmArgs.toString();
+ }
+
+
/**
* Waits for process exit and prints the its output.
*
