Class BasicJavaScriptJob
java.lang.Object
org.htmlunit.javascript.background.BasicJavaScriptJob
- All Implemented Interfaces:
Comparable<JavaScriptJob>
,Runnable
,JavaScriptJob
- Direct Known Subclasses:
JavaScriptExecutionJob
,JavascriptXMLHttpRequestJob
,WorkerJob
A JavaScript-triggered background job managed by a
JavaScriptJobManager
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
private Integer
The job ID.private final int
The initial amount of time to wait before executing this job.private final Integer
The amount of time to wait between executions of this job (maybenull
).private long
The time at which this job should be executed. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new job instance that executes once, immediately.BasicJavaScriptJob
(int initialDelay, Integer period) Creates a new job instance. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(JavaScriptJob other) getId()
Returns the job ID.int
Returns the initial amount of time to wait before executing this job.Returns the amount of time to wait between executions of this job (maybenull
).long
Returns the target execution time of the job.boolean
Returnstrue
if this job has to be executed asap.boolean
Returnstrue
if this job executes periodically.void
Sets the job ID.void
setTargetExecutionTime
(long targetExecutionTime) Sets the target execution time of the job.toString()
-
Field Details
-
id_
The job ID. -
initialDelay_
private final int initialDelay_The initial amount of time to wait before executing this job. -
period_
The amount of time to wait between executions of this job (maybenull
). -
executeAsap_
private final boolean executeAsap_ -
targetExecutionTime_
private long targetExecutionTime_The time at which this job should be executed. Note: the browser will make its best effort to execute the job at the target time, as specified by the timeout/interval. However, depending on other scheduled jobs, this target time may not be the actual time at which the job is executed.
-
-
Constructor Details
-
BasicJavaScriptJob
public BasicJavaScriptJob()Creates a new job instance that executes once, immediately. -
BasicJavaScriptJob
BasicJavaScriptJob(int initialDelay, Integer period) Creates a new job instance.- Parameters:
initialDelay
- the initial amount of time to wait before executing this jobperiod
- the amount of time to wait between executions of this job (maybenull
)
-
-
Method Details
-
setId
Sets the job ID.- Specified by:
setId
in interfaceJavaScriptJob
- Parameters:
id
- the job ID
-
getId
Returns the job ID.- Specified by:
getId
in interfaceJavaScriptJob
- Returns:
- the job ID
-
getInitialDelay
public int getInitialDelay()Returns the initial amount of time to wait before executing this job.- Returns:
- the initial amount of time to wait before executing this job
-
getPeriod
Returns the amount of time to wait between executions of this job (maybenull
).- Specified by:
getPeriod
in interfaceJavaScriptJob
- Returns:
- the amount of time to wait between executions of this job (maybe
null
)
-
isPeriodic
public boolean isPeriodic()Returnstrue
if this job executes periodically.- Specified by:
isPeriodic
in interfaceJavaScriptJob
- Returns:
true
if this job executes periodically
-
isExecuteAsap
public boolean isExecuteAsap()Returnstrue
if this job has to be executed asap.- Specified by:
isExecuteAsap
in interfaceJavaScriptJob
- Returns:
true
if this job has to be executed asap
-
toString
-
compareTo
- Specified by:
compareTo
in interfaceComparable<JavaScriptJob>
-
getTargetExecutionTime
public long getTargetExecutionTime()Returns the target execution time of the job.- Specified by:
getTargetExecutionTime
in interfaceJavaScriptJob
- Returns:
- the target execution time in ms
-
setTargetExecutionTime
public void setTargetExecutionTime(long targetExecutionTime) Sets the target execution time of the job.- Specified by:
setTargetExecutionTime
in interfaceJavaScriptJob
- Parameters:
targetExecutionTime
- the new target execution time.
-