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 Thread
private final List
<WeakReference<JavaScriptJobManager>> private static final org.apache.commons.logging.Log
Logging support.private final AtomicBoolean
private final WeakReference
<WebClient> -
Constructor Summary
ConstructorsConstructorDescriptionDefaultJavaScriptExecutor
(WebClient webClient) Creates an EventLoop for the webClient. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Register a window with the eventLoop.protected JavaScriptJobManager
Returns the JobExecutor corresponding to the earliest job.protected String
Defines the thread name; overload if needed.private void
void
run()
Runs the eventLoop.void
shutdown()
Notes that this thread has been shutdown.protected void
Starts the eventLoopThread_.private void
updateJobMangerList
(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:
addWindow
in interfaceJavaScriptExecutor
- Parameters:
newWindow
- the new web window
-
updateJobMangerList
-
shutdown
public void shutdown()Notes that this thread has been shutdown.- Specified by:
shutdown
in interfaceJavaScriptExecutor
-