Class NashornScriptCallable

  • All Implemented Interfaces:
    Callable<Object>

    public class NashornScriptCallable
    extends Object
    implements Callable<Object>
    The script callable setup the script environment and evaluates the given script. If the script is running the thread id is going to be determined. This id is used to check the memory usage of the process.
    Author:
    Tobias Soloschenko
    • Constructor Detail

      • NashornScriptCallable

        public NashornScriptCallable​(String script,
                                     IResource.Attributes attributes,
                                     ClassFilter classFilter,
                                     Writer writer,
                                     Writer errorWriter)
        Creates a script result
        Parameters:
        script - the script to be executed
        attributes - the attributes to
        classFilter - the class filter to be applied
        writer - the writer to output script prints
        errorWriter - the writer to output errors
    • 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
      • getScript

        public String getScript()
        Gets the script
        Returns:
        the script
      • getAttributes

        public IResource.Attributes getAttributes()
        Gets the attributes
        Returns:
        the attributes
      • getClassFilter

        public ClassFilter getClassFilter()
        Gets the class filter
        Returns:
        the class filter
      • getWriter

        public Writer getWriter()
        Gets the writer
        Returns:
        the writer
      • getErrorWriter

        public Writer getErrorWriter()
        Gets the error writer
        Returns:
        the error writer
      • getThreadId

        public long getThreadId()
        Gets the script callable thread id
        Returns:
        the script callable script id