VCF Automation Blog

from Stefan Schnell

Get Optimization Level of the Rhino Engine


/**
 * Get the optimization level of the Rhino JavaScript engine.
 *
 * @author Stefan Schnell <mail@stefan-schnell.de>
 * @license MIT
 * @version 0.1.0
 *
 * Set in the control center the system property
 * com.vmware.scripting.javascript.allow-native-object to true.
 */

var contextFactory = org.mozilla.javascript.ContextFactory();
var context = contextFactory.getGlobal().enterContext();
var optimizationLevel = context.getOptimizationLevel();
context.exit();
System.log("Optimization Level: " + optimizationLevel);

vcf automation orchestrator optimization level detection
VCF Automation uses always the optimization level -1. That means that the interpretive mode of the Rhino engine is used.