Database Reference
In-Depth Information
However, properties that are marked as final cannot be overridden in later definitions.
The weight property is final in the first configuration file, so the attempt to override
it in the second fails, and it takes the value from the first:
assertThat ( conf . get ( "weight" ), is ( "heavy" ));
Attempting to override final properties usually indicates a configuration error, so this
results in a warning message being logged to aid diagnosis. Administrators mark proper-
ties as final in the daemon's site files that they don't want users to change in their
client-side configuration files or job submission parameters.
Variable Expansion
Configuration properties can be defined in terms of other properties, or system properties.
For example, the property size-weight in the first configuration file is defined as
${size},${weight} , and these properties are expanded using the values found in the
configuration:
assertThat ( conf . get ( "size-weight" ), is ( "12,heavy" ));
System properties take priority over properties defined in resource files:
System . setProperty ( "size" , "14" );
assertThat ( conf . get ( "size-weight" ), is ( "14,heavy" ));
This feature is useful for overriding properties on the command line by using -D prop-
erty = value JVM arguments.
Note that although configuration properties can be defined in terms of system properties,
unless system properties are redefined using configuration properties, they are not access-
ible through the configuration API. Hence:
System . setProperty ( "length" , "2" );
assertThat ( conf . get ( "length" ), is (( String ) null ));
Search WWH ::




Custom Search