Class DefaultJavaScriptExecutor

java.lang.Object
org.htmlunit.javascript.background.DefaultJavaScriptExecutor
All Implemented Interfaces:
Runnable, JavaScriptExecutor

public class DefaultJavaScriptExecutor extends Object implements JavaScriptExecutor
An event loop to execute all the JavaScript jobs.
  • Field Details

  • Constructor Details

    • DefaultJavaScriptExecutor

      public DefaultJavaScriptExecutor(WebClient webClient)
      Creates an EventLoop for the webClient.
      Parameters:
      webClient - the provided webClient
  • Method Details

    • startThreadIfNeeded

      protected void startThreadIfNeeded()
      Starts the eventLoopThread_.
    • getThreadName

      protected String getThreadName()
      Defines the thread name; overload if needed.
      Returns:
      the name of the js executor thread
    • killThread

      private void killThread()
    • getJobManagerWithEarliestJob

      protected JavaScriptJobManager getJobManagerWithEarliestJob()
      Returns the JobExecutor corresponding to the earliest job.
      Returns:
      the JobExectuor with the earliest job.
    • run

      public void run()
      Runs the eventLoop.
      Specified by:
      run in interface Runnable
    • addWindow

      public void addWindow(WebWindow newWindow)
      Register a window with the eventLoop.
      Specified by:
      addWindow in interface JavaScriptExecutor
      Parameters:
      newWindow - the new web window
    • updateJobMangerList

      private void updateJobMangerList(JavaScriptJobManager newJobManager)
    • shutdown

      public void shutdown()
      Notes that this thread has been shutdown.
      Specified by:
      shutdown in interface JavaScriptExecutor