3.7.3 Defining Multiple Override Files for the Same Element

3.7.3 Defining Multiple Override Files for the Same Element

3.7.3 Defining Multiple Override Files for the Same Element

Any element in the tangosol-coherence.xml deployment descriptor can be overridden using the predefined tangosol-coherence-override.xml file. However, there may be situations where more fine-grained configuration control is required. For example, a solution may want to allow changes to certain elements, but does not want to allow changes to the complete operational deployment descriptor. As another example, a solution may want to provide different configurations based on different use cases. Custom override files are used to support these types of scenarios.

Override files are defined using the xml-override attribute and, if required, the id attribute. Both of these attributes are optional and are added to the operational element that is to be overridden. See “Attribute Reference” for a list of the operational elements that support the use of an override file.

The value of the xml-override attribute is the name of a document that is accessible to the classes contained in the coherence.jar library using the ClassLoader.getResourceAsStream(String name) method. In general, the file name contains a / prefix and is located in the classpath at run time. The attribute also supports the use of a URL when specifying the location of an override file.

For example, to define an override file named cluster-config.xml that is used to override the element, add an xml-override attribute to the element in the tangosol-coherence-override.xml file as shown below:

To use this override file, create a document named cluster-config.xml and ensure that it and the base document ( tangosol-coherence-override.xml in this case) are located in a directory that is in the classpath at run time. For this example, the override file’s root element must be as shown below.

For example, https://hookupdate.net/es/wiccan-dating-es/ to define a custom override file named dist-service-config.xml that is used to override the element for the distributed cache service, add an xml-override attribute to the element whose id is number 3 as shown below

To use this override file, create a document named dist-service-config.xml and ensure that it is located in a directory that is in the classpath at run time. For this example, the override file’s root element must be as shown below.

If the element’s id in the override document does not have a match in the base document, the elements are just appended to the base document.

Multiple override files can be defined for the same element to chain operational override files. This is typically done to allow operational configurations based on different deployment scenarios, such as staging and production.

As an example, the tangosol-coherence.xml operational deployment descriptor located in coherence.jar defines an operational override file for the element as follows:

The mode-specific override files are also located in coherence.jar and are used depending on the Coherence start mode (the value of the element). Each of the mode-specific operational override files, in turn, defines the default operational override file as follows:

The chain can continue as required. The files are all loaded at run time if they are placed in a location in the classpath. Files higher up in the chain always override files below in the chain.

3.8 Changing Configuration Using System Properties

The command-line override feature allows operational and cache settings to be overridden using system properties. System properties are typically specified on the Java command line using the Java -D option. This allows configuration to be customized for each node in a cluster while using the same operational configuration file and cache configuration file across the nodes. System properties are also a convenient and quick way to change settings during development.

3.8.1 Using Preconfigured System Properties

Coherence includes many preconfigured system properties that are used to override different operational and cache settings. Table C-1 lists all the preconfigured system properties. The preconfigured system properties are defined within the tangosol-coherence.xml and coherence-cache-config.xml default deployment descriptors, respectively, using system-property attributes.

Napsat komentář

Your email address will not be published. Required fields are marked *.

*
*
You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>