// This is pretty ugly - we have to set some thread locals so we can get a reference to the scope and
// classloader in the load() method - this is because Rhino insists load() must be static
scopeThreadLocal.set(scope);
clThreadLocal.set(cl);
Require require = installRequire(cl, cx, scope);
Scriptable script = require.requireMain(cx, scriptName);
try {
stopFunction = (Function) script.get("vertxStop", scope);
} catch (ClassCastException e) {
// Get CCE if no such function
stopFunction = null;