JREs
In the rare event that a particular service cannot use the default JRE that is deployed to the Engines, a JRE can be packaged as a Grid Library. The Service’s top-level Grid Library then declares it as a dependency. When an Engine takes a Task, it then restarts using this JRE. Note that the JRE must be a supported version.
JREs are packaged as jre_name-version.gz or jre_name-version.zip where, jre_name includes jre-os. The version is the JRE version, for example, 1.8.0.331. The os is the platform, such as linux64, win64, linux, or win32.
For example, for linux 64: jre-linux64-1.8.0.331.tar.gz.
For a JRE Grid Library, you can optionally specify JVM arguments in the XML. To do so, add an <arguments> element to the root element. It can take any number of <property> elements, each containing a <name> element and an optional <value> element.
If the property has a value, the argument name=value is added. Otherwise, only the name argument is added.
If the same argument is set in the Engine Configuration and the Grid Library, the Grid Library overrides the Engine Configuration.
|
Note |
Specifying the JVM debug port inside a Grid Library results in unpredictable behavior and is not supported. Set this functionality with the Debug Start Port setting on the Grid Components > Engines > Engine Configurations page. |
Example: Creating a Multi-Platform JRE Grid Library
Here is an example of how to use the same JDK version Grid Library for Linux and Windows:
| 1. | Locate a functional installation of the target JDK version for each target platform. |
| 2. | Create a grid-library.xml file with the following contents: |
For Linux:
<?xml version="1.0" encoding="UTF-8"?>
<grid-library jre="true" os="linux">
<grid-library-name>jre-linux</grid-library-name>
<grid-library-version>1.8.0.0</grid-library-version>
<lib-path>
<pathelement>./jre/lib/ext</pathelement>
<pathelement>./jre/lib/i386</pathelement>
<pathelement>./jre/lib/i386/server/</pathelement>
<pathelement>./jre/bin</pathelement>
<pathelement>./jre/lib/i386/native_threads/</pathelement>
</lib-path>
</grid-library>
For Windows:
<?xml version="1.0" encoding="UTF-8"?>
<grid-library jre="true" os="win64">
<grid-library-name>jre-win64</grid-library-name>
<grid-library-version>1.8.0.0</grid-library-version>
<lib-path>
<pathelement>jre/bin</pathelement>
<pathelement>jre/bin/server</pathelement>
<pathelement>jre/lib</pathelement>
<pathelement>jre/lib/ext</pathelement>
</lib-path>
</grid-library>
Note that the order of pathelement is important. For example, if you want the server VM, then jre/lib/i386/server must come before jre/lib/i386. This also applies to the native_threads directory.
| 3. | Create the Grid Library archive for each platform containing the grid-library.xml that you created above and the JRE you wish to use. Each archive (either a tar.gz or zip) has a top-level directory containing the grid-library.xml file and the jre directory. |
| 4. | Name the Grid Library for each appropriate platform. For example, 1.8.0.0-linux.tar.gz for Linux and 1.8.0.0-win32.zip for Windows |
| 5. | Add the following dependencies to your application: |
<dependency>
<grid-library-name>jre-win64</grid-library-name>
<grid-library-version>1.8.0.0</grid-library-version>
</dependency>
<dependency>
<grid-library-name>jre-linux</grid-library-name>
<grid-library-version>1.8.0.0</grid-library-version>
</dependency>
After performing these steps your application uses the exact JRE version that you have specified for each platform.