Class JavaCommandLineBuilder
java.lang.Object
org.apache.hadoop.yarn.service.containerlaunch.CommandLineBuilder
org.apache.hadoop.yarn.service.containerlaunch.JavaCommandLineBuilder
Command line builder purely for the Java CLI.
Some of the
define methods are designed to work with Hadoop tool and
Slider launcher applications.-
Field Summary
Fields inherited from class org.apache.hadoop.yarn.service.containerlaunch.CommandLineBuilder
argumentList -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddConfOption(org.apache.hadoop.conf.Configuration conf, String key) voidaddConfOptions(org.apache.hadoop.conf.Configuration conf, String... keys) Add a varargs list of configuration parameters —if they are presentaddConfOptionToCLI(org.apache.hadoop.conf.Configuration conf, String key, String defVal) Ass a configuration option to the command line of the applicationvoidaddMandatoryConfOption(org.apache.hadoop.conf.Configuration conf, String key) Add a mandatory config optionintaddPrefixedConfOptions(org.apache.hadoop.conf.Configuration conf, String prefix) Add all configuration options which match the prefixvoidAdd a-D key=valcommand to the CLI.booleandefineIfSet(String key, String val) Add a-D key=valcommand to the CLI ifvalis not nullvoidTurn Java assertions onprotected StringGet the java binary.headless()voidsetJVMOpts(String jvmOpts) Set JVM opts.voidAdd a system property definition -must be used before setting the main entry pointMethods inherited from class org.apache.hadoop.yarn.service.containerlaunch.CommandLineBuilder
add, addOutAndErrFiles, build, size, toString
-
Constructor Details
-
JavaCommandLineBuilder
public JavaCommandLineBuilder()
-
-
Method Details
-
getJavaBinary
Get the java binary. This is called in the constructor so don't try and do anything other than return a constant.- Returns:
- the path to the Java binary
-
setJVMOpts
Set JVM opts.- Parameters:
jvmOpts- JVM opts
-
enableJavaAssertions
public void enableJavaAssertions()Turn Java assertions on -
sysprop
Add a system property definition -must be used before setting the main entry point- Parameters:
property-value-
-
forceIPv4
-
headless
-
addConfOption
-
addConfOptions
Add a varargs list of configuration parameters —if they are present- Parameters:
conf- configuration sourcekeys- keys
-
addPrefixedConfOptions
Add all configuration options which match the prefix- Parameters:
conf- configurationprefix- prefix, e.g"slider."- Returns:
- the number of entries copied
-
addConfOptionToCLI
public String addConfOptionToCLI(org.apache.hadoop.conf.Configuration conf, String key, String defVal) Ass a configuration option to the command line of the application- Parameters:
conf- configurationkey- keydefVal- default value- Returns:
- the resolved configuration option
- Throws:
IllegalArgumentException- if key is null or the looked up value is null (that is: the argument is missing and devVal was null.
-
define
Add a-D key=valcommand to the CLI. This is very Hadoop API- Parameters:
key- keyval- value- Throws:
IllegalArgumentException- if either argument is null
-
defineIfSet
Add a-D key=valcommand to the CLI ifvalis not null- Parameters:
key- keyval- value
-
addMandatoryConfOption
public void addMandatoryConfOption(org.apache.hadoop.conf.Configuration conf, String key) throws BadConfigException Add a mandatory config option- Parameters:
conf- configurationkey- key- Throws:
BadConfigException- if the key is missing
-