Skip to main contentCarbon Design System

Script compilation and caching

Script code is written into the source code field of the Automation Script application. Alternately, you can import the script code as the Automation Script wizards can create new launch points and scripts. Once you complete the Automation Script wizard steps or click Save Script in the Automation Scripts application, the contents of the field are compiled, cached into memory, and finally saved to the Maximo database.

Script compilation

At run time, when a script is to be executed, the interpreter, which is the JSR223 driver is given the script code. The interpreter loads, evaluates, and executes the script code. If this sequence of tasks is performed every time a script is to be executed, script execution becomes very inefficient and business application responsiveness is adversely impacted. Instead of using this approach, Maximo scripting framework compiles and caches the script. Script compilation immediately reads, evaluates, and compiles into intermediate bytecode in a single execution. Once this intermediate bytecode is cached, there is significant time saved, as script execution no longer needs to load and evaluate the script code.

Intermediate bytecode

The ability to compile a script depends upon support available in the underlying scripting engine. Maximo ships with the Nashorn js and Jython scripting engines, both of which support compiling a script into Java byte code. Other scripting engines may not offer the same support.

Script cache

Maximo implements a script cache that loads the Java bytecode representation of a script into memory. This cache enables script execution to be more efficient. The script cache is refreshed under the following conditions:

  • Launch point and script created using Automation Scripts application
  • Existing script modified and saved from Automation Scripts application
  • Application server start up of Maximo

The script cache adheres to Maximo’s standard caching mechanism and script changes are automatically propagated to all Java Virtual Machine (JVM) instances in a clustered environment.

Script execution

At run time, script execution is triggered by the Maximo scripting framework using the appropriate script language interpreter. If an error is encountered, statements and traces relating to the error are written to the application server console and/or the product log file, if the latter has been configured. Script execution stops upon encountering the first error. Maximo always writes the script execution time in milliseconds to the application server console and/or the product log file.