Class DefaultJavaScriptExecutor
java.lang.Object
org.htmlunit.javascript.background.DefaultJavaScriptExecutor
- All Implemented Interfaces:
Runnable,JavaScriptExecutor
An event loop to execute all the JavaScript jobs.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Threadprivate final List<WeakReference<JavaScriptJobManager>> private static final org.apache.commons.logging.LogLogging support.private final AtomicBooleanprivate final WeakReference<WebClient> -
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.private voidvoidrun()Runs the eventLoop.voidshutdown()Notes that this thread has been shutdown.protected voidStarts the eventLoopThread_.private voidupdateJobMangerList(JavaScriptJobManager newJobManager)
-
Field Details
-
webClient_
-
jobManagerList_
-
shutdown_
-
eventLoopThread_
-
LOG
private static final org.apache.commons.logging.Log LOGLogging support.
-
-
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
-
killThread
private void killThread() -
getJobManagerWithEarliestJob
Returns the JobExecutor corresponding to the earliest job.- Returns:
- the JobExectuor with the earliest job.
-
run
public void run()Runs the eventLoop. -
addWindow
Register a window with the eventLoop.- Specified by:
addWindowin interfaceJavaScriptExecutor- Parameters:
newWindow- the new web window
-
updateJobMangerList
-
shutdown
public void shutdown()Notes that this thread has been shutdown.- Specified by:
shutdownin interfaceJavaScriptExecutor
-