Class DefaultJavaScriptExecutor
java.lang.Object
org.htmlunit.javascript.background.DefaultJavaScriptExecutor
- All Implemented Interfaces:
Runnable, JavaScriptExecutor
An event loop to execute all the JavaScript jobs.
- Author:
- Amit Manjhi, Kostadin Chikov, Ronald Brill
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultJavaScriptExecutor(WebClient webClient) Creates an EventLoop for the webClient. -
Method Summary
Modifier and TypeMethodDescriptionvoidRegister a window with the eventLoop.protected JavaScriptJobManagerReturns the JobExecutor corresponding to the earliest job.protected StringDefines the thread name; overload if needed.voidrun()Runs the eventLoop.voidshutdown()Notes that this thread has been shutdown.protected voidStarts the eventLoopThread_.
-
Constructor Details
-
DefaultJavaScriptExecutor
Creates an EventLoop for the webClient.- Parameters:
webClient- the provided webClient
-
-
Method Details
-
startThreadIfNeeded
protected void startThreadIfNeeded()Starts the eventLoopThread_. -
getThreadName
Defines the thread name; overload if needed.- Returns:
- the name of the js executor thread
-
getJobManagerWithEarliestJob
Returns the JobExecutor corresponding to the earliest job.- Returns:
- the JobExectuor with the earliest job.
-
run
-
addWindow
Register a window with the eventLoop.- Specified by:
addWindowin interfaceJavaScriptExecutor- Parameters:
newWindow- the new web window
-
shutdown
public void shutdown()Notes that this thread has been shutdown.- Specified by:
shutdownin interfaceJavaScriptExecutor
-