Class BasicJavaScriptJob
java.lang.Object
org.htmlunit.javascript.background.BasicJavaScriptJob
- All Implemented Interfaces:
Comparable<JavaScriptJob>, Runnable, JavaScriptJob
A JavaScript-triggered background job managed by a
JavaScriptJobManager.- Author:
- Daniel Gredler, Amit Manjhi
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new job instance that executes once, immediately. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(JavaScriptJob other) getId()Returns the job ID.intReturns the initial amount of time to wait before executing this job.Returns the amount of time to wait between executions of this job (maybenull).longReturns the target execution time of the job.booleanReturnstrueif this job has to be executed asap.booleanReturnstrueif this job executes periodically.voidSets the job ID.voidsetTargetExecutionTime(long targetExecutionTime) Sets the target execution time of the job.toString()
-
Constructor Details
-
BasicJavaScriptJob
public BasicJavaScriptJob()Creates a new job instance that executes once, immediately.
-
-
Method Details
-
setId
Sets the job ID.- Specified by:
setIdin interfaceJavaScriptJob- Parameters:
id- the job ID
-
getId
Returns the job ID.- Specified by:
getIdin 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:
getPeriodin interfaceJavaScriptJob- Returns:
- the amount of time to wait between executions of this job (maybe
null)
-
isPeriodic
public boolean isPeriodic()Returnstrueif this job executes periodically.- Specified by:
isPeriodicin interfaceJavaScriptJob- Returns:
trueif this job executes periodically
-
isExecuteAsap
public boolean isExecuteAsap()Returnstrueif this job has to be executed asap.- Specified by:
isExecuteAsapin interfaceJavaScriptJob- Returns:
trueif this job has to be executed asap
-
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<JavaScriptJob>
-
getTargetExecutionTime
public long getTargetExecutionTime()Returns the target execution time of the job.- Specified by:
getTargetExecutionTimein interfaceJavaScriptJob- Returns:
- the target execution time in ms
-
setTargetExecutionTime
public void setTargetExecutionTime(long targetExecutionTime) Sets the target execution time of the job.- Specified by:
setTargetExecutionTimein interfaceJavaScriptJob- Parameters:
targetExecutionTime- the new target execution time.
-