code: protected boolean isCachable(ScriptEngine scriptEngine) {
      // Check if script-engine supports multithreading. If true it can be cached.
      Object threadingParameter = scriptEngine.getFactory().getParameter("THREADING");
      return threadingParameter != null;
    }
docs: Allows checking whether the script engine can be cached.
  
  @param scriptEngine the script engine to check.
  @return true if the script engine may be cached.