Class JsEvaluator

  • All Implemented Interfaces:
    java.lang.Runnable

    class JsEvaluator
    extends java.lang.Object
    implements java.lang.Runnable
    The JavaScript evaluator. It is designed to run Nashorn engine in separate thread (using provided ExecutorService), to allow limit cpu time consumed.

    Created on 2017.11.22

    Version:
    $Id$
    • Field Detail

      • scriptEngine

        private final javax.script.ScriptEngine scriptEngine
      • result

        private java.lang.Object result
      • exception

        private java.lang.Exception exception
    • Constructor Detail

      • JsEvaluator

        JsEvaluator​(javax.script.ScriptEngine scriptEngine,
                    long maxCPUTime,
                    long maxMemory,
                    ScriptEngineOperation operation)
    • Method Detail

      • isScriptKilled

        boolean isScriptKilled()
      • isCPULimitExceeded

        boolean isCPULimitExceeded()
      • isMemoryLimitExceeded

        boolean isMemoryLimitExceeded()
      • runMonitor

        void runMonitor()
        Enter the monitor method. It should be called from main thread.
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • getException

        java.lang.Exception getException()
      • getResult

        java.lang.Object getResult()