Class NashornResource

    • Constructor Detail

      • NashornResource

        public NashornResource​(ScheduledExecutorService scheduledExecutorService,
                               long delay,
                               TimeUnit delayUnit,
                               long wait,
                               TimeUnit waitUnit,
                               long maxScriptMemorySize)
        Creates a new nashorn resource
        Parameters:
        scheduledExecutorService - the scheduled executor service to run scripts
        delay - the delay until a script execution is going to be terminated
        delayUnit - the unit until a script execution is going to be terminated
        wait - how long to w8 until the next memory check occurs
        waitUnit - the unit until the next memory check occurs
        maxScriptMemorySize - the memory usage the script process should use - else it will be aborted
    • Method Detail

      • setup

        protected void setup​(IResource.Attributes attributes,
                             Bindings bindings)
        Setup the bindings and make information available to the scripting context
        Parameters:
        attributes - the attributes of the request
        bindings - the bindings to add java objects to
      • getClassFilter

        protected ClassFilter getClassFilter()
        Gets the class filter to apply to the scripting engine
        Returns:
        the class filter to apply to the scripting engine
      • getWriter

        protected Writer getWriter()
        Gets the writer to which print outputs are going to be written to the default is to use NullWriter
        Returns:
        the writer for output
      • getErrorWriter

        protected Writer getErrorWriter()
        Gets the writer to which error messages are going to be written to the default is to use NullWriter
        Returns:
        the error writer
      • isDebug

        protected boolean isDebug()
        If debug is enabled
        Returns:
        if debug is enabled