Configure Runtime Java options

Semarchy xDI Runtime starts by running a Java command that includes command-line options. You can set your own Java options for xDI Runtime in two ways:

  1. Add Java options to environment variables that xDI recognizes.

  2. Add Java options to the initvariables startup script.

Both methods pass arguments to Java at startup. You must use command-line syntax such as -D<property>=<value> or other valid arguments. Separate multiple arguments with spaces, and use quotes to delimit values that contain spaces.

The first method is the most reliable and compatible, and you should use it where possible.

Make sure your runtime is not running before changing the configuration or environment.

How to set Java options

With environment variables

The environment variables that xDI Runtime looks for work in different situations, and you can set one or both as needed:

  • XDI_COMMAND_OPTS: Applies to the Runtime startcommand.bat and startcommand.sh scripts.

  • XDI_RUNTIME_OPTS: Applies to all other Runtime runnable scripts.

Both environment variables take space-separated Java options in command-line format.

With the initvariables script

The initvariables script takes Java options that apply to all xDI Runtime actions.

  1. In the runtime install directory, find the initvariables.bat (Windows) or initvariables.sh (Linux, macOS) file.

  2. Open the file for editing.

  3. Go to the line that starts with XDI_RUNTIME_VM_PROPERTIES or set XDI_RUNTIME_VM_PROPERTIES.

  4. Add your Java arguments alongside the existing commands, in command-line format.

List of Runtime Java options

This section lists Java settings or properties that are of particular use to xDI Runtime.

Set runtime memory capacity

By default, Runtime allows the Java Virtual Machine to manage memory automatically. The default should work in most cases, but you can use -X Java arguments to set Runtime memory usage.

To change Runtime memory usage, set these in the initvariables script or in environment variables.

Example 1. Example arguments
# Minimum heap size
-Xms512m
# Maximum heap size
-Xmx2048m
# Stack size
-Xss4m

Set the runtime shutdown delay

xDI Runtime understands a custom Java property that controls its shutdown delay.

To configure the runtime’s shutdown delay, use the com.semarchy.xdi.graceful-shutdown-delay property, and set its value to an integer followed by a time designator.

Example 2. Example
-Dcom.semarchy.xdi.graceful-shutdown-delay=30s

Manage runtime monitoring with Java Management Extensions

Java Management Extensions (JMX) is a technology for managing and monitoring Java applications. It allows you to follow memory or class usage with utilities like jmap or external tools such as Visual VM. Java enables JMX features by default, but only on the local machine unless explicitly set otherwise. In this way, you can make use of JMX to monitor the xDI Runtime locally.

For more information about JMX, see the Oracle documentation.

If you want to prevent tools from monitoring the xDI Runtime, you can disable JMX in one of two ways.

  1. Stop the xDI Runtime.

  2. Edit or create the XDI_RUNTIME_OPTS environment variable for your machine or user session.

  3. Append the parameter -XX:+DisableAttachMechanism to this variable.

  4. Start the xDI Runtime

Block monitoring in the startup file

  1. Stop the xDI Runtime.

  2. Edit the initvariable.bat (Windows) or initvariable.sh (Linux, macOS) file.

  3. Add the parameter -XX:+DisableAttachMechanism to the XDI_RUNTIME_VM_PROPERTIES variable in the file.

  4. Start the xDI Runtime