|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl
public class JavaScriptJobManagerImpl
Default implementation of JavaScriptJobManager
.
This job manager class is guaranteed not to keep old windows in memory (no window memory leaks).
This job manager is serializable, but any running jobs are transient and are not serialized.
MemoryLeakTest
,
Serialized FormConstructor Summary | |
---|---|
JavaScriptJobManagerImpl(WebWindow window)
Creates a new instance. |
Method Summary | |
---|---|
int |
addJob(JavaScriptJob job,
Page page)
Adds the specified job to this job manager, assigning it an ID. |
JavaScriptJob |
getEarliestJob()
Gets the earliest job for this manager. |
int |
getJobCount()
Returns the number of active jobs, including jobs that are currently executing and jobs that are waiting to execute. |
void |
removeAllJobs()
Removes all jobs from the execution queue. |
void |
removeJob(int id)
Removes the specified job from the execution queue. |
boolean |
runSingleJob(JavaScriptJob givenJob)
Runs the provided job if it is the right time for it. |
void |
shutdown()
Shuts down this job manager and stops all of its jobs. |
void |
stopJob(int id)
Stops the specified job and removes it from the execution queue, not even allowing the job to finish if it is currently executing. |
int |
waitForJobs(long timeoutMillis)
Blocks until all active jobs have finished executing. |
int |
waitForJobsStartingBefore(long delayMillis)
Blocks until all jobs scheduled to start executing before (now + delayMillis) have finished executing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JavaScriptJobManagerImpl(WebWindow window)
window
- the window associated with the new job managerMethod Detail |
---|
public int getJobCount()
getJobCount
in interface JavaScriptJobManager
public int addJob(JavaScriptJob job, Page page)
addJob
in interface JavaScriptJobManager
job
- the job to add to the job managerpage
- the page which is trying to add the job
public void removeJob(int id)
removeJob
in interface JavaScriptJobManager
id
- the ID of the job to be removed from the execution queuepublic void stopJob(int id)
stopJob
in interface JavaScriptJobManager
id
- the ID of the job to be stoppedpublic void removeAllJobs()
removeAllJobs
in interface JavaScriptJobManager
public int waitForJobs(long timeoutMillis)
waitForJobs
in interface JavaScriptJobManager
timeoutMillis
- the maximum amount of time to wait (in milliseconds); may be negative, in which
case this method returns immediately
public int waitForJobsStartingBefore(long delayMillis)
waitForJobsStartingBefore
in interface JavaScriptJobManager
delayMillis
- the delay which determines the background tasks to wait for (in milliseconds);
may be negative, as it is relative to the current time
public void shutdown()
shutdown
in interface JavaScriptJobManager
public JavaScriptJob getEarliestJob()
getEarliestJob
in interface JavaScriptJobManager
null
if nonepublic boolean runSingleJob(JavaScriptJob givenJob)
runSingleJob
in interface JavaScriptJobManager
givenJob
- the job to run
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |